Player incline() function fail with TiledSprite - android

Hi I'm developing a game by using andengine.I have a player in my game created with TiledSprite.Also there box2d physic engine.Here is the porblem: Player is moving ahead.But a while later there is a wall on his top and if he wanna continue to go ahead, he has to incline.Incline method just make "player.setCurrentTileIndex(12);". So player image is getting small(incline position).Till here everything is right.But playerBody isn't getting small.That's why he still can't pass the wall by inclining.How can I solve it?
You can understand the problem with photos better:
In this picture, he can't go in there:
http://t1310.hizliresim.com/1g/j/tmpyd.png
In this picture, he can go in there but he can't:
http://j1310.hizliresim.com/1g/j/tmpz2.png

I searched this stutation and found this: destroy the fixture and create new one. But I need this solution with code examples. I couldn't get it well.

You have to create new body for it everytime.

Related

WebRTC Android Share Screen the second time give black screen

I'm having trouble solving this bug and hope someone can guide me. I created the share screen function in android with WebRTC (EglBase). it works perfectly fine until the user stops sharing and then shares again, the participant's screen will be a black screen, and can't see the content.
I have already check the SurfaceViewRenderer is assigned correctly. I believe the problem may be on how I implemented the init() and release() functions.
In this function, I init the screen share video
EglBase root = EglBase.create();
screenShare.init(root.getEglBaseContext(), null);
screenShare.setZOrderMediaOverlay(true);
remoteParticipant.setView(screenShareVideoView);
In this function, I release the screen share
screenShare.clearImage();
screenShare.release();
screenShare.setVisibility(View.INVISIBLE);
Maybe I re-init the view after release() incorrectly.

Why my Unity game in Android freezes when calling LoadScene?

The game freezes permanently when I try to load the next scene but when I load it with "Additive" mode it's loaded fine (using SceneManager.LoadScene("NextScene", LoadSceneMode.Additive)).
In editor everything works even with mode "Single", the problem only appears with Android.
I don't want to use the "Additive" mode because it loads the content of the new scene above the old one.
I try:
using "adb logcat" to see if any exception occurs but there are no exceptions.
load an empty scene as a new scene but the problem still appears.
load using SceneManager.LoadSceneAsync("NextScene") but the problem still appear.
load with "Additive" mode and after the next scene is loaded I try to Unload the old scene using SceneManager.UnloadScene("OldScene") but it freezes again.
So the problem appears when Unity try to unload the old scene.
(I use Unity 2018.4.10f1 LTS).
Thanks in advance for any help.
Try to delete the objects from the last scene
In for loop to see what object response for the error
I try to build the game with PC and I face the same problem.
I see what in the output_log.txt file in "C:/Users/.../AppData/Local/Temp/.../My game name/Crashes" and the first readable messages after the crash are like this:
"ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFEF20E5212)"
without any other errors or exceptions by my game,
so I try to test the game with an updated version of Unity (2018.4.10f1 --> 2018.4.20f1),
Abracadabra everything works fine with the new version!!
and the problem doesn't appear anymore!!
I think it was a memory management problem in Unity 2018.4.10f1 but I don't know why.

Android drag and return to previous activity like Facebook and Google Photos

I have been finding a way to implement animation like Facebook and Google Photos. When in 2nd Activity, when dragging images the images follow and the 2nd Activity started to fade out and we see 1st Activity. Images of what I was trying to ask is here.
Was you able to find a full fledged solution for this ?
https://github.com/nickbutcher/plaid , It might give clues to entry transition and how that was accomplished . So it might help you there. But how about when you want to drag and dismiss that activity?
https://github.com/Commit451/ElasticDragDismissLayout , Its an interesting library. Does do drags . But doesn't remember the position where the thumbnail where it was launched from. Only handles 1 swipe direction and dismisses by sliding to the right. So its not that close to what they do in 2017 Jun Google Photos Android application. You might have to modify it.
If anyone knows a better solution to this please do share.
I have found some code from Nick Butcher sample code.
ElasticDragDismissFrameLayout.java
and when using it:
chromeFader = new ElasticDragDismissFrameLayout.SystemChromeFader(getWindow()) {
#Override
public void onDragDismissed() {
finishAfterTransition();
}
};

RepeatingSpriteBackground on MenuScene

I have started using Andengine, and after following some tutorials I'm starting to develope for myself.
Right now I have a a BaseGameActivity where I call one splashScene(working fine) and after that my MenuScene.
If i set a simple background (just color) it loads fine (all menu text are displayed), but when i try to set a repeating sprite as background, a black screen appears (no error show in logcat)
I'm using the example code for the background
super(BaseActivity.getSharedInstance().mCamera);
activity = BaseActivity.getSharedInstance();
RepeatingSpriteBackground mGrassBackground = new RepeatingSpriteBackground(mCamera.getWidth(), mCamera.getHeight(), activity.getTextureManager(), AssetBitmapTextureAtlasSource.create(activity.getAssets(), "images/menu/background.png"), activity.getVertexBufferObjectManager());
this.setBackground(mGrassBackground);
I placed this code in the MenuScene constructor.
Thanks in advance and sorry for my English
I just discover my problem.
The code was right the problem was in the image format, it has to be a power of two (it says that clearly in the source code comments)
Next time I will try to read carefully before asking

Android Play only 1 sound at a time

I have created a soundboard and am having trouble getting just one sound to play at a time. If another button is pressed I want the current button to stop playing and the new button to begin. I also want sounds to stop when pressing the next or back button.
Is there any code that can help me out with this?
Here's some information for you that can help you solve your problem:
http://developer.android.com/reference/android/media/SoundPool.html
http://www.androidsnippets.com/playing-sound-fx-for-a-game
But like Falmarri pointed out, we're here to help on code and correct in need, not to write an app for you :)
The Android docs do not tell you how to build something, they only tell you what the parts do. Kinda like throwing parts at someone with detailed information of the parts, then expecting them to build an engine. The real world doesn't work that way!!
Here is what you need Paul. I use this code a lot:
private static SoundManager SM;//Field variable to hold sound manager.
SM = new SoundManager(); //Create sound manager
SM.initSounds(getBaseContext());
SM.addSound(1, R.raw.snd_loop_1);//Add sounds. Sounds go in /res/raw
SM.addSound(2, R.raw.snd_loop_2);
SM.addSound(3, R.raw.snd_ok_1);
Then you can call the sounds on demand with SM.playSound(1);
If you need a permanent running background loop, you can call the same sound with SM.playLoopedSound(2);
I hope it helps!

Categories

Resources