This site requires JavaScript, please enable it in your browser!
Greenfoot
Username
Password
Remember Me?
Sign Up, Lost Password
Activity
About
Documentation
Download
Discuss
Scenarios
Williamli
wrote ...
2017/7/6
SETLOCATION
Williamli
2017/7/6
#
I don't know how to setLocation
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
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
2017/7/6
#
it works, but when I do if(greenfoot.isKeyDown(up)) theres a red line under up
Williamli
2017/7/6
#
?
1
2
3
if
(Greenfoot.isKeyDown(up)){
setLocation(x,y+a);
}
danpost
2017/7/6
#
The isKeyDown method of the Greenfoot class requires a String type parameter:
?
1
if
(Greenfoot.isKeyDown(
"up"
)){
Williamli
2017/7/6
#
oh thanks
You need to login to post a reply.
X