Hi guys,
I am making a game where my speedboat object needs to 'slide' a bit after I've done a movement. It eventually needs to stop (offcourse). When I am moving now and stop pressing the keys, it just immediately stops, but I want it to slide a little after I stop pressing the buttons in the direction it was moving. Does anyone here has an idea of how I should do this or could someone send me a piece of code please? This is the movement code so far:
Thanks for the help already!
public class SpeedBoat extends Actor { public void act() { if(Greenfoot.isKeyDown("left")) { turn(-3); } if(Greenfoot.isKeyDown("up")) { move(1); } if(Greenfoot.isKeyDown("down")) { move(-1); } if(Greenfoot.isKeyDown("right")) { turn(3); } }