andengine

AndEngine - Sprites are not getting scaled on different devices

a 夏天 提交于 2019-12-06 06:19:44
Code : This is how m initializing camera. I', trying to get resolution of device and based on that i set camera width and height. public class GameActivity extends SimpleBaseGameActivity { private SmoothCamera mCamera; private DisplayMetrics dM; private int CAMERA_WIDTH, CAMERA_HEIGHT; private double ScreenWidth, ScreenHeight, resolutionRatio; public EngineOptions onCreateEngineOptions() { //set Camera getDeviceResolution(); setCamera(); EngineOptions options = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy((int)this.getCameraWidth(),(int)this

how to move sprite object using AndEngine (Android)

六眼飞鱼酱① 提交于 2019-12-06 04:17:24
问题 I am using andengine to develop a game in android. I placed an object in sprite like this.mTexture = new Texture(32, 32, TextureOptions.BILINEAR_PREMULTIPLYALPHA); this.mFaceTextureRegion = TextureRegionFactory.createFromAsset(this.mTexture, this, "gfx/bike.png", 0, 0); ---- and i place like Sprite bikeSprite= new Sprite(20, 50, this.mFaceTextureRegion); I want to use this sprite in j2me sprite bikeSprite.move(--); How do I do it in android. I dont want to use setPosition . 回答1: public class

AndEngine Sprite/Box2D Body removal crashes my program with no error/exception information?

≡放荡痞女 提交于 2019-12-06 04:07:22
问题 I am making a skateboarding game with obstacles you have to jump over using box2D and AndEngine. I am trying to make it so that when the player collides with an object, the object is removed and an explosion is placed at the objects old position, however something in the sprite removal code is freezing my program causing it to end (not even a force close message it just closes itself and goes to my home screen) and no error/exception information appears in logcat so I have no idea what is

Queue multiple entity modifiers in AndEngine

时光总嘲笑我的痴心妄想 提交于 2019-12-06 02:46:52
I'm trying to have a sprite ("pointer" below) along two paths, one after the other. Here is my code: scene.attachChild(pointer); pointer.clearEntityModifiers(); pointer.registerEntityModifier(new MoveModifier( 1.0f, 540, 960, 1000, 1000, new IEntityModifierListener() { public void onModifierStarted(IModifier<IEntity> pModifier, IEntity pItem) {} public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) { clickSound.play(); pointer.clearEntityModifiers(); pointer.registerEntityModifier(new MoveModifier( 1.0f, pointer.getX(), pointer.getY(), 500, 2500, new

Switching from AndEngine to libgdx - what to know? [closed]

青春壹個敷衍的年華 提交于 2019-12-05 22:15:29
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago . I've been testing with AndEngine for months, but still haven't produced any game prototypes. There are few reasons why I want to switch to libgdx: - AndEngine is using libgdx's INI wrapper for Box2d, but updates reach Andengine slowly - I'm primarily targeting Android, but having

Out of memory error when restarting app (Android)

♀尐吖头ヾ 提交于 2019-12-05 15:22:00
I am working on an game that uses 5 large images that are around 900x600. When I exit the game(press the back button) and then try to launch the game, I get the following error: 12-29 15:59:16.633: E/AndroidRuntime(18642): FATAL EXCEPTION: GLThread 17 12-29 15:59:16.633: E/AndroidRuntime(18642): java.lang.OutOfMemoryError: (Heap Size=20423KB, Allocated=3473KB, Bitmap Size=77KB) 12-29 15:59:16.633: E/AndroidRuntime(18642): at org.andengine.opengl.util.GLHelper.getPixelsARGB_8888(GLHelper.java:165) 12-29 15:59:16.633: E/AndroidRuntime(18642): at org.andengine.opengl.util.GLHelper.getPixels

andengine apply force

冷暖自知 提交于 2019-12-05 11:25:10
does anyone know why applyforce only works on one of my sprites? Also when I press the other sprites it also applies force to the one individual sprite. The nextTile method works fine. enter code here package com.martynnorman.jude; /** * @author Nicolas Gramlich * @since 11:54:51 - 03.04.2010 */ public class MainActivity extends BaseGameActivity implements IOnAreaTouchListener { // =========================================================== // Constants // =========================================================== private static final int CAMERA_WIDTH = 720; private static final int CAMERA

Google Play Game Services - Custom Notification / Welcome Back

扶醉桌前 提交于 2019-12-05 08:44:58
I have been looking all over the internet, but can't find my answer. Is there a way to show the user that they are signed in to the GPGS. The first time you sign in you'll get a notification, what will say "Welcome < name >" But when you open the app the next time nothing is shown. Is there a way to show a Welcome Back notification? For iOS it is possible: noted just above Step 9: https://developers.google.com/games/services/ios/quickstart?hl=en#step_9_add_a_sign-out_button Any ideas? user2346305 If you want the official Welcome Back Notification (the one that shows when a user is

Terrain curve to array of points

喜欢而已 提交于 2019-12-05 05:28:25
In my 2D game I'm using graphic tools to create nice, smooth terrain represented by black color: Simple algorithm written in java looks for black color every 15 pixels, creating following set of lines (gray): As you can see, there's some places that are mapped very bad, some are pretty good. In other case it would be not necessary to sample every 15 pixels, eg. if terrain is flat. What's the best way to covert this curve to set of points [lines], using as little points as possible? Sampling every 15 pixels = 55 FPS, 10 pixels = 40 FPS Following algorithm is doing that job, sampling from right

Showing adds in gameplay in AndEngine Android

巧了我就是萌 提交于 2019-12-04 20:22:50
Hi I want to show adds at the top of the game in AndEngine. Can any one help me with this?? Oops I got the answer so posting. @Override protected void onSetContentView() { final FrameLayout frameLayout = new FrameLayout(this); final FrameLayout.LayoutParams frameLayoutLayoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.FILL_PARENT); final AdView adView = new AdView(this, AdSize.BANNER, "XXXXXXXXXXXXXXXXX"); adView.refreshDrawableState(); adView.setVisibility(AdView.VISIBLE); final FrameLayout.LayoutParams adViewLayoutParams = new