11/9/2023 0 Comments Greenfoot breakoutA year ago I was the one asking questions here so I'm quite new at answering other peoples questions. Okay a lot of code to go through (okay maybe not a lot), but I hope that at least some of what I said makes sense. RemoveObject(attempts) This removes the attempt balls from right to left depending on how many attempts you have left. GameIsRunning = true Here I declare that the game is running because you spawned a new ball and therefore you should not be able to spawn another before the current ball is lost.ĪttemptsCounter- When you spawn a new ball by pressing the spacebar you lose an attempt. Grey bricks will take 3 hits until breaking. attemptsCounter > 0 checks how many attempts the player has left. In case you dont know the target is to break all bricks to get to the next level. Download Greenfoot for free: runs on Windows, Mac and Linux The Book Introduction to Programming with Greenfoot is the official book used by both teachers and students The Greenroom. The gameIsRunning checks wether the game is running and by that I mean that a ball is in play, so basicly this secures that you can't spawn a new ball while another ball is in play (you should therefore add gameIsRunning = false to the place in your code where you check if the ball is lost and you have to spawn a new one). Secondly gameIsRunning = false is a boolean meaning that it's a datatype which can be true og false. ![]() ![]() First of all Greenfoot.isKeyDown("space") checks that space is pressed. It's just almost only guys who program.įirst of all the act method gets called frequently.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |