andengine

Box2D/AndEngine - ContactListener for multiple object classes

拥有回忆 提交于 2019-12-25 01:16:05
问题 I'm developing a little Android game in Java, using AndEngine for graphics and Box2D for physics - specifically, collision handling. I have some different types of objects with constructors in classes, like so: MainActivity.java Enemy.java Npc.java Door.java I have a static PhysicsWorld in the main class, and I was setting up a ContactListener from the Enemy class, to define what happens when one of the enemies hits something. However, I tried to set up another ContactListener for the Door

ANDROID ANDENGINE — Set Scene background as trasparent

假装没事ソ 提交于 2019-12-24 15:27:01
问题 ­I'm starting to use AndEngine in my app. I've used an xml to define the base style of the app. I've defined a scene in which I'll have some draggable sprites. I've imported correctly the xml but the scene appears on top of that with a black background that hides the xml graphics. I need to set the scene with transparent background. How can i do that? 回答1: Actually you can do that. It was at least working some time ago with AndEngine running on top of a Camera preview. It has really been a

Android: Error in AndEngine

青春壹個敷衍的年華 提交于 2019-12-24 10:36:52
问题 I am trying to learn game programming in Android . I have set GPU emulation in the AVD to "yes" and the AndEngine library version to be 4.1 I have also set the version of project be 4.1 but still the following error occurs please help me. I am using the sample code for tower of hanoi. E/AndroidRuntime(698): at org.andengine.opengl.view.ConfigChooser.chooseConfig(ConfigChooser.java:183) D/gralloc_goldfish(786): Emulator without GPU emulation detected. E/AndroidRuntime(786): FATAL EXCEPTION:

How Do I Build Multi-Layered Scenes with AndEngine?

风流意气都作罢 提交于 2019-12-24 08:56:01
问题 I am a noob to android development and i am trying to learn how to use AndEngine. I want to construct a scene where a sprite appears from behind an object in the foreground and then disappears in a whack-a-mole fashion. I've reviewed every example project but can't find anything code that shows how to do this. any help is greatly appreciated. Currently, I am trying to use a sprite to set the foreground scene to no avail. @Override public Scene onCreateScene() { this.mEngine

Using PathModifier or MoveYModifier to simulate sprite jumping

≯℡__Kan透↙ 提交于 2019-12-23 20:49:09
问题 I am using this method in AndEngine to determine the scene being touched by the user. @Override public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) { if(pSceneTouchEvent.isActionDown()) { Log.e("Arcade", "Scene Tapped"); //Simulate player jumping } return false; } What i want to do is when the scene is tapped, i want to allow the player to jump. Now two things for this would it be better to use PathModifier, or MoveYModifier considering it is landscape mode? If either

AndEngine: Use of PIXEL_TO_METER_RATIO

泪湿孤枕 提交于 2019-12-23 16:07:29
问题 I am new to AndEngine. I have seen use of PIXEL_TO_METER_RATIO in lot of places but not able to understand when and how this constant is used. Can anyone guide to the right direction? 回答1: Box2d, the underlying physics engine used by AndEngine, uses meters as standard units. PIXEL_TO_METER_RATIO describes how many pixels in AndEngine are equivalent to one meter in the physics engine. For example, if you get a position of the Body, it will be in meters. You would multiply it by the ratio to

Making a sprite jump when user taps on the screen?

别等时光非礼了梦想. 提交于 2019-12-23 12:23:06
问题 I am using andengine to implement a sprite being able to be dragged across the screen using this. So what i want to do is when the user taps any where on the screen make the sprite jump. or move up and then move down. What is the best way to go bout doing this with andengine? 回答1: This should work: @Override public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) { if(pSceneTouchEvent.isActionDown()) { //Jump only if the user tapped, not moved his finger or something final

Load Animation with Texture Packer in andengine

纵饮孤独 提交于 2019-12-23 12:07:35
问题 I use Texture Packer. I have .pvr.ccz file there are 10 frames. I need to create an AnimatedSprite with this animation, but TexturePacker extension return only TextureRegion files. How I can create TiledTextureRegion from this file? 回答1: public TiledTextureRegion getTiledTextureFromPack(String name) { TexturePackTextureRegionLibrary packer; TexturePack spritesheetTexturePack; try { spritesheetTexturePack = new TexturePackLoader(game.getTextureManager(), "packs/") .loadFromAsset(game.getAssets

Android AndEngine Physics - images issue

匆匆过客 提交于 2019-12-23 06:01:07
问题 I'm working on a little game/project and I decide to use AndEngine for it because basically the Add/Remove Physics functionality in that engine was all I need. But it seems that I have a little problem with it. I have to add like 36 different pictures on a scene and be able to remove them on select. The problem is that my images are damaged and it's not showing all the images, just the first two. Am I missing something or I'm doing it wrong? Here is what I get on my device : and here is my

Android AndEngine Physics - images issue

谁说我不能喝 提交于 2019-12-23 06:00:14
问题 I'm working on a little game/project and I decide to use AndEngine for it because basically the Add/Remove Physics functionality in that engine was all I need. But it seems that I have a little problem with it. I have to add like 36 different pictures on a scene and be able to remove them on select. The problem is that my images are damaged and it's not showing all the images, just the first two. Am I missing something or I'm doing it wrong? Here is what I get on my device : and here is my