This site requires JavaScript, please enable it in your browser!
Greenfoot back
Mohhaer
Mohhaer wrote ...

2018/4/16

How to make object move auto, but not transparent other object?

Mohhaer Mohhaer

2018/4/16

#
Help me please
Jol159 Jol159

2018/4/16

#
1
2
3
4
5
6
7
8
public void flySpaceship()
    {
        move(2);
        if(isAtEdge())
        {
            setLocation(550,250);
        }
    }
The code above will move the spaceship when the code is run at a speed of 2. It will also reset the spaceship to the specified location if it reaches the edge of the game world. Hope this helps a bit!
Jol159 Jol159

2018/4/16

#
Mohhaer wrote...
Help me please
1
2
3
4
5
6
7
8
public void flySpaceship()
    {
        move(2);
        if(isAtEdge())
        {
            setLocation(550,250);
        }
    }
The code above will move the spaceship when the code is run at a speed of 2. It will also reset the spaceship to the specified location if it reaches the edge of the game world. Hope this helps a bit!
You need to login to post a reply.