andengine

Andengine - Always keep the same speed of the body

≡放荡痞女 提交于 2019-12-12 04:33:21
问题 I am developing a game where you are on side scroll on screen middle (player) and enemyes appears from left or right continusly. I create a enemy, set a Linearvelocity to right (or left) on this way: getBody.setLinearVelocity(v*this.getDireccion(), 0); Then, when the enemy collides with another enemy or player, sometimes change direction (he slides back) or get more slow or fast. I need that always have the same LinearVelocity, and if this enemy is colliding with a player or another monster,

How to use TMX map object property to change objects behaviour

丶灬走出姿态 提交于 2019-12-12 03:56:50
问题 i am developing game in andEngine using Tiled maps in TMX map i have river object and i want player will be die after falling in river but i have no idea how to implement this I am only able to create wall objects using this code: private void createUnwalkableObjects(TMXTiledMap map) { // Loop through the object groups for(final TMXObjectGroup group: this.mTMXTiledMap.getTMXObjectGroups()) { if(group.getTMXObjectGroupProperties().containsTMXProperty("wall", "true")) { // This is our "wall"

How to have LevelLoader method 'ignore' undefined entities?

旧巷老猫 提交于 2019-12-12 02:59:47
问题 I am using a method of loading an xml file into a game as a level very similar to this: private void loadLevel(int levelID) { final SimpleLevelLoader levelLoader = new SimpleLevelLoader(vbom); final FixtureDef FIXTURE_DEF = PhysicsFactory.createFixtureDef(0, 0.01f, 0.5f); levelLoader.registerEntityLoader(new EntityLoader<SimpleLevelEntityLoaderData>(LevelConstants.TAG_LEVEL) { public IEntity onLoadEntity(final String pEntityName, final IEntity pParent, final Attributes pAttributes, final

how to display admob smartbanner exactly on the bottom of the screen while using andEngine CropResolutionPolicy

一笑奈何 提交于 2019-12-12 02:21:57
问题 So heres the deal. I am making a game in andEngine and I use CropResoltionpolicy (how it works: http://android.kul.is/2013/10/andengine-tutorial-dealing-with-screen-sizes.html). I have engine camera set as 480x800 in horizontal orientation. but the devices resolution is 1920x1080. In my game top and bottom parts of the screen are overflowing devices screen (see the previous link, how red rectangles are overflowing on left and right of the screen). So when I add banner that starts directly on

Completely remove scene in AndEngine

老子叫甜甜 提交于 2019-12-12 01:26:06
问题 To switch between levels in my game I recreate my GameScene, but but when I switch levels about 3 or 4 times I get an errno 12 out of memory error. I need to be able to somehow delete the whole scene and stop it from running in the background. Is there a way to do this so I don't run out of memory? EDIT: This is my method in which I load the new scene. public void loadGameScene(final Engine mEngine, final SharedPreferences sp, final String map) { setScene(loadingScene); ResourcesManager

Andengine PhysicsHandler makes player look laggy

筅森魡賤 提交于 2019-12-11 20:21:43
问题 Hey my problem is that in the onUpdate in PhysicsHandler the pSecondsElapsed often jumps from 0.016... to 0.038 which makes the player move in such big steps that it looks like the player would lagg. Here to the importante Code from the onUpdate : @Override protected void onUpdate(final float pSecondsElapsed, final IEntity pEntity) { if(this.mEnabled) { /* Apply linear acceleration. */ final float accelerationX = this.mAccelerationX; final float accelerationY = this.mAccelerationY; if

AlertDialog in AndEngine

我们两清 提交于 2019-12-11 19:56:32
问题 I am trying to show a alertdialog but i keep getting this error 01-24 21:52:45.640: E/AndroidRuntime(31119): FATAL EXCEPTION: UpdateThread 01-24 21:52:45.640: E/AndroidRuntime(31119): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() 01-24 21:52:45.640: E/AndroidRuntime(31119): at android.os.Handler.<init>(Handler.java:121) 01-24 21:52:45.640: E/AndroidRuntime(31119): at android.app.Dialog.<init>(Dialog.java:100) 01-24 21:52:45.640: E

How do I get a body to bounce around the screen when there is gravity (Box2D/AndEngine)?

梦想与她 提交于 2019-12-11 16:22:01
问题 I've done quite a bit of searching and have found multiple suggestions for anti-gravity objects, but nothing seems to work just right. I have a physics world created with Earth's gravity. The user taps the screen and creates sprites/dynamic bodies. These then fall to the bottom of the screen due to the gravity. I have another sprite/body that is supposed to bounce around the screen, ignoring gravity and bouncing off the sprites that have been created. AndEngine's Box2D does not seem to have

Android: AndEngine - AnimatedSprite texture size too large?

房东的猫 提交于 2019-12-11 13:48:49
问题 sorry if this issue's been asked before but I couldn't find a reference to it, trying to start using andEngine and I'm trying to use an image 3360x720, because it's tiled with 7 columns. I've tried this method: // Initialize the background this.mBackgroundTexture = new Texture(4096, 1024, TextureOptions.BILINEAR); this.mEngine.getTextureManager().loadTextures(this.mBackgroundTexture); this.mBackgroundRegion = TextureRegionFactory.createTiledFromAsset(this.mBackgroundTexture, this, "back_anim

runOnUpdateThread in andengine

二次信任 提交于 2019-12-11 13:45:58
问题 Could anyone explain exactly what this method does in AndEngine? runOnUpdateThread(new Runnable() { @Override // to safely detach and re-attach the sprites public void run() { } }); EDIT: To be more specific, the runOnUpdateThread in general 回答1: This is an Engine method that executes the Runnable when the engine is updating the scene. All scene updates must happen on the update thread (just as all rendering must happen on the UI thread). This method can be used from outside the update thread