Hi, I'm a new greenfoot user. This class creates a target that goes up, and then goes down after it reaches a random y-location. How can I have the instantiation of the class decelerate as it goes up, and the accelerate as it goes down?
import greenfoot.*; public class Target extends Actor { private int stopLocation; private boolean hasStop; public Target() { stopLocation = Greenfoot.getRandomNumber(200); hasStop = false; } public void act() { if(hasStop) setLocation(getX(), getY() + 1); //moveup if(getY() == (stopLocation + 100)) { //the object stops at (stopLocation + 100) setLocation(getX(), getY()); //stop hasStop = true; } if(!hasStop) setLocation(getX(), getY() - 1); //moves up if (getY() == 399) { //if it reaches the bottom again, game over. ((CannonWorld) getWorld()).gameOver(); } }