if (Greenfoot.isKeyDown("left"))
{
turn(-4);
}
After I used that for the left key, I added it for the right.
if (Greenfoot.isKeyDown("right"))
{
turn(-4);
}
This is my first attempt at using the keyboard.
In the video I showed how when I added
turn(-4);
for left and right, both keys did the same thing. But then I realized that I had to be able to make them go different directions so i changed the code for right to:
turn(4);
So I added some worms and played my game. Then I made sure the code was the same as the book and started messing around with the images.
No comments:
Post a Comment