I am developing a game in libgdx
.
The game consists of an actor, which the camera constantly follows with that actor centered.
My problem is that the movement of the actor is not resolved, because I would like it to behave like Snake.io
, the snake always moves and you only add / change the direction.
At the moment I do not move the actor because I wanted to find out how to make the movement that I asked. Anyway, the movement you would use is a simple movement:
public static final float SPEED = 100;
....
@Override
public void render(float delta){
....
actor.setPosition(actor.getX() + (SPEED * delta * dirX), actor.getY() + (SPEED * delta * dirY));
....
}
dirX and dirY are the coordinates of the joystic to get the address.
It is a 2D game with overhead view. I would like it to always move forward. Forward I mean if the actor turns, keep going forward, keeping the direction the actor has taken. I get this address with the joystick.
translate does not work for me, but I do not see the option. The same is because I do not use sprites, I use textures and actors. Also, I'm using Scene2D and box2D, which I had not mentioned before.
I need to create a continuous actor movement, that without the user putting any buttons, moves, but when the user moves the joystick that direction is applied to the actor, the actor can move freely around the screen