# Tag Info

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 MAGNITUDE*sin( FREQUENCY*t )...

13

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 ...

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 ...

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 -...

9

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 ...

8

What you want to do is something called LERP. Stands for Linear Interpolation, and you can do with the follow: If you know how many seconds have passed, and what is the total, you might do the follow: u = total / passedTime u is your "progress" variable, on a LERP. So, as your start value is 0 and the final value is 360, we do the following: current = ...

7

Move the camera (attached to your player). I would imagine that your world has multiple objects such as enemies. If you went with moving the world, you would have to loop through all these objects to update their positions every time the world moved. If you move the player, and attach the camera to the player then there is minimal resource usage. The game ...

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

1) I think this is referenced here, and if not there's a decent community over there to ask. Even a bunch of tutorials/examples documented. 2) If I'm not mistaken I think you should always use transforms/forces to move anything associated with a body to correctly step with the Box2D physics...

5

Usual solution for concurrency problems is data isolation. Isolation means that every thread has its own data, and does not touch data of other threads. This way there are no problems with concurrency... but then we have problem of communication. How can these threads work together if they don't share any data? There are two approaches here. First one is ...

5

Your question is a bit rough but if I'm following correctly, you want to make it so the background is stretched horizontally as it moves towards the bottom of the screen, giving it a somewhat isometric view and a more angled perspective. Just as a warning, I've no direct android development experience myself so this is going to be largely theoretical. ...

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

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.

5

The camera hierarchy goes like this: SmoothCamera extends -> ZoomCamera extends -> BoundCamera - Zoom cameras adopt Bound camera properties/methods. Smooth cameras adopt Zoom camera and Bound camera properties/methods Choosing a SmoothCamera you'll have all the functionality from the others. The difference between them is that they simply gain ...

4

In JBox2d, to remove at the correct time: public class Main { World world; ... public void update() //your game loop { ... //do all actual update loop stuff, including detection of collision/death/destruction for (Entity entity : manager.entitiesToRemove) { world.destroyBody(entity.body); //this might be ...

4

Is it possible to use a separate thread for the game action? I'm wondering if the menu being activated is consuming the current thread (this is a guess based on my experience in programming applications in Java that use menus). I suspect that what's going on is that you have one main thread, and that by activating the menu your code is temporarily halted ...

4

Your problem is inherently serial -- you must complete an update of the simulation before you can render it. Offloading the simulation to a different thread simply means the main UI thread does nothing while the simulation thread ticks (which means it is blocked). The commonly held "best practice" for concurrency is not to put your rendering on one thread ...

4

Probably 99% of the computer programs written in history used just 1 thread and worked fine. I don't have any experience of the AndEngine but it's very rare to find systems that require threading, just several that could have benefited from it, given the right hardware. Traditionally, to do simulation and GUI/rendering in one thread, you simply do a bit of ...

4

Since the game state is going to be specific to your game, there isn't built in functionality for this in the engine. One solution would be to write the state information you want to keep to an XML file. Likely you'd want to load this saved state in your onStart() function. But really that's up to you and how you want your game to behave. There's a blog ...

4

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

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.

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