Tag Info

Hot answers tagged

2

A possible problem is in your SetInStartPosition(). For setting the Y position it should be position.Y = screenBounds.Height - texture.Height... not screenBounds.Width - texture.Width...


1

Are you assigning cheetahX to something or drawing with it? You did not post your drawing method or where you use cheetahX further on in your code. I predict that Cheetah holds your InputHandler then you need this: public class inputHandler implements InputProcessor { private cheetah cheetah; private gameWorld myWorld; private float cheetahX; ...


1

If I remember correctly, I iterate through all sprites and use their inverse affine matrix to convert the click coordinate into local space for the sprite. I then use a trivial bounding box check to determine if the local coord can be ruled out quickly as a hit for that sprite. If the bounding box check passes, I then perform an alpha test on the pixel of ...


1

For normal cases, sprite order is determined by the Spritebatch.draw() call order. If this is the case: spritebatch.draw(apple); spritebatch.draw(mango); then apple will be drawn first and then mango will be drawn on top of that. So mango will overlap apple.


1

Correct me if I am wrong, but from what I understand, you want to achieve the following: If so, this can be achieved using trigonometry: float easing = 0.075f; float direction = Math.atan2(target.y - sprite.y, target.x - sprite.x) / Math.PI * 180; if (direction < sprite.rotation - 180) { direction += 360; } if (direction > sprite.rotation + ...


1

I have to agree with Ben. You can do things in Update but once you start having to manage many different objects changing simultaneously it is much nicer to do it with CoRoutines. Having said that, it took me several iterations and seeing good examples in the Unity demos to feel like I understood them properly. For now, go with what makes the most sense. ...


1

Please take note that the question was unclear and changed meaning 3 times, hence the 3 answers in one How can I verify that a given size is a multiple of another? This is a very good case to use the Modulo operator. Let's say you have a texture tex with size (width, height). Now you want to render the texture with size (drawWidth, drawHeight) on the ...



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