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

2017/7/6

SETLOCATION

Williamli Williamli

2017/7/6

#
I don't know how to setLocation
Williamli Williamli

2017/7/6

#
Im making a flappy bird game and I want to make it so that when I press space it could just move up somehow
danpost danpost

2017/7/6

#
If the current location of an actor is: ( getX() , getY() ) then a location of distance 'd' above it would be: ( getX() , getY() - d )
Williamli Williamli

2017/7/6

#
it works, but when I do if(greenfoot.isKeyDown(up)) theres a red line under up
Williamli Williamli

2017/7/6

#
1
2
3
if(Greenfoot.isKeyDown(up)){
            setLocation(x,y+a);
        }
danpost danpost

2017/7/6

#
The isKeyDown method of the Greenfoot class requires a String type parameter:
1
if (Greenfoot.isKeyDown("up")){
Williamli Williamli

2017/7/6

#
oh thanks
You need to login to post a reply.