12/26/2023 0 Comments Greenfoot chapter 2 shouthorray errorAll of these actors (FlappyBird, Pipe, etc) must only act if the game is not paused. Look through your classes to see which Actors move during their act() functions. To do this we'll add another global variable to our FlappyWorld: boolean isPaused = true Next, you need a way to have your program not act when the Greenfoot start button is pressed. Then add these both as global variables in your FlappyWorld code. Ĭreate an Actor for the title and another for the start button. You can create your own images, pull them from the original sprite sheet, or download them here. On the title screen are two new Actors: A "Flappy Bird" title and a Start button. Today, we're going to add a title screen to Flappy Bird. Finally stop the game using the appropriate command from the Greenfoot class. Then use getWorld() to get the World you're in and tell it to add the GameOver object using the addObject() function. Version: 5 In this version, the crab behaves as before, but we add animation of the image. They like sand worms (very yummy, especially the green ones). Want further detail? When FlappyBird reaches the bottom of the screen use thenew keyword to create a new GameOver object and store it in a variable. // (World, Actor, GreenfootImage, and Greenfoot) / This class defines a crab. Next, inside your FlappyBird code, when FlappyBird reaches the bottom of the screen you should tell the World to add a new GameOver object to the center of the screen and then stop the game. You will turn this in at the end of each chapter. Whenever you are asked to try something out or record something use this worksheet as your record of that work. It is expected that you are reading the textbook and following the exercise instructions. Take notes on it and record page numbers as needed. Here's one way: Create a new GameOver actor using the "game over" image in the image folder. Solutions Use as a checklist for the activities in the chapter. When FlappyBird reaches bottom of screen, stop the game and display a Game Over image instead of printing to the console. To use the functions in this class, write Greenfoot.functionName() Look for a function in this class that ends the game. Go to the main Greenfoot window (where you play the game) and select Help | Greenfoot Class Documentation. Hints: To stop game execution, look for a method in the API for the Greenfoot class. When FlappyBird reaches bottom of screen stop the game and print "Game Over" to the console window using ("Game Over") Click here to download the project images.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |