Hello,
I was trying to make a game with an actor a rocket.
The thing i want to do is to make for ever when the left click of the mouse is pressed the actor's Y must change to the Mouse's Y
Here's the code:
public class Rocket extends Actor
{
/**
* Act - do whatever the Rocket wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
MouseInfo mouse = Greenfoot.getMouseInfo();
public void act()
{
if(Greenfoot.mouseClicked(this))
{
setLocation(mouse.getX(),getY());
}
}

