16

You are looking for the wondrous atan2. // v1 moving object float boxX = this.mScene.getLastChild().getX(); float boxY = this.mScene.getLastChild().getY(); // v2 user touch float touchX = pSceneTouchEvent.getX(); float touchY = pSceneTouchEvent.getY(); double theta = 180.0 / Math.PI * Math.atan2(boxX - touchX, touchY - boxY); Normally it is used as ...


14

The "ripple" effect you are showing is just a radial sinewave: sin(t), where t is the distance from some center. Image from here Doing this kind of deformation in a vertex or pixel shader is easy: just set up the center of the wave as a uniform variable waveCenter, then move every vertex in z (where z is the "up" direction) by MAGNITUDEsin( FREQUENCYt ), ...


13

Fundamentally, it looks like snow because the particles are round and they don't convey motion in any way. Rain drops are typically seen as elongated droplets, even to the point at which they are lines rather than particles. Think of a scene where you are looking out of a window at a rainstorm: you're not seeing individual drops suspended in the air, you're ...


10

The mechanics for air hockey are not particularly deep, so it wouldn't take much to generate reasonable behavior. Think of the movement of the paddle as comprised of several different types of movement: Wander - to some extent people simply move the paddle around, both left and right and forward and back to keep the enemy guessing. Defend - blocking the ...


9

When we rotate a object in 2d, each corner is a vector (x,y) away from the center. That vector has an angle. Get the offset of the selected corner from the center: cornerOffset.x = corner.x - center.x; cornerOffset.y = corner.y - center.y; To calculate this angle we do something like this in AS3 / Java angle = Math.Atan2(corner.y - center.y, corner.x - ...


6

I think the RUBE editor might be what you're looking for. It does however export the box2d bodies in a JSON format, so you'll probably need to figure out yourself how to load these. It is very well documented tough.


6

I'm not familiar with AndEngine, but the obvious general approach is to turn off collisions between the character and platforms whenever the character's vertical velocity is positive (i.e. the character is moving upwards). If your platforms (or character) have a non-negligible thickness, you may need to deal with the situation where the character partially ...


6

USE GLES2 AndEngine is a little tricky to get configured properly the first time you try. I recommend installing the version stored at RealMayo's github, which is a stable version. That's a version of GLES2 and yes, it's definitely worthwhile to use GLES2 over GLES1. Many new features were added that make life easier, improve performance, and add great ...


6

Color value basically consists of 4 single byte channel values, these 4 value represent R, G, B and transparency(A) of that color. An integer value is also a 4 byte value, so these two types are used interchangeably. Based on the name of the function you are using I'm guessing the R is packed as the byte with lowest value, and A is the highest value byte. so ...


5

LoopEntityModifier is the way to go! Not sure, but it may end as something like this: LoopEntityModifier EntityModifier = new LoopEntityModifier( new RotationModifier(yourargs) );


5

What about (pseudo-code): update(float dt){ sprite.rotation += degreesPerSecond * dt; }


5

I'm assuming you're talking about a joystick; one which, when active, always points toward your finger. It looks like your X and Y values are positions relative to one corner of the screen - so you're just measuring the angle from one corner of the screen to your finger. Of course it would never work! Well, unless your stick is on the corner of the screen. ...


5

To get the best result, you need to run the simulation like if you actually threw the projectile - just fast forward! And that is quite easy in any Box2D port. In AndEngine call method step(float timeStep, int velocityIterations, int positionIterations) from class com.badlogic.gdx.physics.box2d.World in a loop to run it as fast as you want. You can apply ...


5

In most update methods there is a delta, which provides the number of milliseconds (or some other measurement of time) since the last update was called. By calculating all of your movement calculations using both a delta and a movement speed, you get movement that is unaffected by a fluctuating frame rate. The following is code pulled from the movement ...


5

I believe what you're asking is how to get rid of letterboxing, like this: By default, AndEngine assumes you want some fixed aspect ratio. It then uses letterboxing to handle devices with different display aspect ratios then what you're providing. The advantage is you have certainty about your layout. There's more than one approach to get rid of them, ...


5

I add my code its for temporary code you can change this code set your life of player life = 10; final Sprite whiteSprite= new Sprite(0, 0, testRegion); scene.attachChild(whiteSprite); width = whiteSprite.getWidth(); scale = width/life; Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public ...


5

Yes, it is possible. AndEngine has a Level loader that can do exactly what you need. I recommend going through these tutorials. In the final tutorial, creating a whole game, one of the chapters talks about level creating and loading. Look for a class named SimpleLevelLoader.


4

Luckily, I found the solution of my problem and here I post the answer for other community member to help them. I set Mask Bit for each part of the body like leg,hand,chest,head. So that they don't collide with each other. As a result the continuous movement of the ragdoll was stop.


4

Also, aside from what MrCranky said, rain does not really have a color, it more just deforms the world around it, so to get accurate rain you really need to be using shaders. That said, you can fake it using long streaks (like what MrCranky said) that are all in line with eachother


4

I'm not sure about AndEngine but in Box2D you can call the following functions: fixture->SetDensity(5.0f); //this fixture is attached to body below body->ResetMassData(); //must call this after changing density AndEngine's physics is just a JNI wrapper around Box2D so it should support all or a subset of Box2D features. Also check 7.4 Using a Body ...


4

While this isn't how, it should be noted that: (this will help with speed) You almost never see rain by itself, you only see it when it hits the ground or passes through a lit object (like a light post). The simplest way to mimic rain without drawing any rain particles is to add fog to the world and add raindrops to the world, with maybe a few rain streaks. ...


4

I suppose you could call it a collision, but it's more like an intersection. You can create a trigger zone that activates when the player enters it. A simple way of doing that would just create a list of these zones, then check to see if the player is inside them every frame or when the player moves. A zone is just two points, a min and a max. Then you can ...


4

AndEngine uses Box2D. You can find more information simply by seeing the manual, which includes explanations for the concepts you're asking, here. Specifically, 6.2 :) For examples, if you feel confortable with javascript, I would suggest you to go here, a website with a lot of working examples of a Javascript port of Box2D (I believe that the names of the ...


4

You can flip the texture like so: myTextureRegion.setFlippedHorizontal(true); or by using the sprite mySprite.setFlippedHorizontal(true); // set false to flip it back Have you looked at AnimatedSprite class? AnimatedSpriteClass You could google for examples. It's in the API


4

additional condition to check visibility of sprite prevented second executions of die method physicsConnector = new PhysicsConnector(this,body,true,false) { @Override public void onUpdate(final float pSecondsElapsed) { super.onUpdate(pSecondsElapsed); if (!camera.isRectangularShapeVisible(_bullet) && _bullet.isVisible()) { ...


4

Your TextureOptions settings are likely to be the cause, see the call that you use for creating your TextureAtlas. Try the different TextureOptions and see which one you like the most. For more information, see the related thread on the AndEngine forum.


4

My second question is that my actual game scene uses bound camera and I perform scrolling on that camera but my other scene uses the normal camera. So in this situation what to do? how to use multiple camera for single engine? or how to reset available current camera? Our 3d game engine allows us to create as many render targets we wish. A render target is ...


4

It's not going to be easy. I don't know much about AndEngine, but I've developed some GLES 2 apps, and it is possible to run and test them inside an AVD (in the Android world, "Virtual Device", or AVD is the correct term, not "emulator"). Looking at the logcat, I can see that there is a first exception: 02-23 15:18:50.983: D/AndEngine(636)...


4

AndEngine's physics extension is a port of Box2D. And Box2D's faq says this about tile based environments that should be "smooth": Using many boxes for your terrain may not work well because box-like characters can get snagged on internal corners. A future update to Box2D should allow for smooth motion over edge chains. In general you should ...


Only top voted, non community-wiki answers of a minimum length are eligible