New answers tagged

0

Something very simple I used on Tiny Avengers and many other mini beat'em all was to link the Y axis to the Z axis. The more the object is up the more in depth it will be. So if your character is at 25 on Y it will also be at 25 on Z... which means that a crate placed at 20 on Y will be displayed in front of the player and will give an effect of depth. ...


1

This is called arrival. It's a steering behavior. The basic concept is: Apply an acceleration towards the target position (alternatively, you can simply set the velocity if you're not using acceleration) When within a defined range of the target object, start applying acceleration away from the object, this acceleration is scaled based on the distance to ...


0

You'll have to change the velocity after your object reaches the correct position. You could store the target position in your script, and you could check the distance to the target during Update. Once the object has arrived, set the velocity back to zero. Arrival should be determined by some non-zero minimum distance to the target, because the object is ...


0

I haven't tested it but it seems you may want to use the Berp method from here, instead of Lerp. public static float Berp(float start, float end, float value) { value = Mathf.Clamp01(value); value = (Mathf.Sin(value * Mathf.PI * (0.2f + 2.5f * value * value * value)) * Mathf.Pow(1f - value, 2.2f) + value) * (1f + (1.2f * (1f - value))); return ...


0

Silly me, I assumed I already made the Player's Rigidbody a trigger. Also, you need to make each and every child of the planet (like the tops of the planet) that you want to let the player bounce on to be static; not just the empty object parent. I'm very sorry I never double-checked, but I hope this helps others out.


3

You need to implement some sort of a timer. A basic implementation could work like the following: start by calculating the next time when a block should move, which might look something like nextMoveTime = SDL_GetTicks() + 200;. Then, each frame/update cycle, you would check if enough time has passed and if so, move the block. So something simple like if (...


0

It seems like you are going about this the wrong way. Linear interpolation is the process of transitioning from one value to a second value, which is exactly what you are looking for with your movement. I'm unaware of java and libgdx syntax, but here's some example code so you get the idea. Here's what you need: Vector2 CurrentPosition : Your characters ...


0

The solution can be achieved in multiple ways, but checking the remaining distance between the current and the target position is a good way to go about this. distance = targetPosition.sub(position).getLength(); if (distance < some_small_constant) { position = targetPosition; } The code first creates a vector from the current position to the target ...


0

@eldo's answer is good, but since you are doing this from scratch, you need to begin implementing systems for physics. There are all manner of ways to do this, from implementing a quadtree of physical space (so you're only checking sections that your moving object will pass through), to implementing colliders like Unity does (and I believe Unreal Engine has ...


2

It s a bit unclear what you are asking, in particular what you mean by "gametic". A computer game re-paints the screen repeatedly. Between two re-paints you have a delta time T, typically 0.01...0.03 s. Say it is 0.02 s this time - note however that it fluctuates. Then you can calculate the physics & movement over a single calculation, to which you ...


1

I havent done much on these lines. But every object should recive (time_elapsed) and calculate new position accordingly. They should check for possible collision with static objects, and react (change of direction / state). As far as other closer moving objects, you will have to do some hack (either treat the slower one as static, or get its ...


0

I would say the reason is there is small numeric error in position computation. Because you i += the error starts accumulating resulting in out-of-sync after some time. In order to overcome this, I would suggest a different implementation. Try calculating the position from total time on move: public float startTime; public float time; public bool move = ...


1

In nutshell your a movement would look something like this: speedX speedY for vertical and horizontal speed. You have a velocityX and velocityY for example. Lets say its a top down game. And you have your positions like posX and posY. Every tick you update your positions: posX += speedX; posY += speedY; You assing a value to velocity like 0.2. In you ...


0

I have a similar problem with jerky frames using android GL 2.0. When traced on android studio GL profiler I saw that the glcompileshader function is called multiple times during game play. This is an expensive call but accounts for the jerkiness. What causes these multiple calls to glcompilershader? I can only guess happens because the shader is invalid ...



Top 50 recent answers are included