task 1

I will be presenting my version of a very popular game back in 2015 called Flappy Bird. Obviously, I changed it up a bit and I created the game on a website that I downloaded called Greenfoot. There was a lot of coding involved and downloading images.

(Image unavailable)

Here you can see a rough idea on how my game looks and what i have added and named on the right side.
My theme of this flappy bird is space like you can see the outer space background which sets the perfect atmosphere for the main “player” which is the alien spaceship. I set the pipes in a position where the “player” can go through to complete the course but obviously there are many of them and the goal is to go through as many pipes as possible and try to beat the high score.

(Image unavailable)

As you can see in the source code I made my world public so everyone can access it. Then inside the blue text I made it public so I can code the “player” and “pipes” so it accessible for everyone to use. The brackets and numbers show how I want the size and layout to be. You insert “;” to make it valid so when playing it works because the”;” completes what you are trying to make. The “}” finishes off the whole code so it completely validates everything you coded. The brackets means something new and makes sure its there but everything has to match up in order for it to work. When done press compile and that tells you if there are any mistakes and if nothing pops up then you successfully completed your code for the first step. When I pressed compiled I did make mistakes like 3 times but eventually I got there at the end.

(Image unavailable)

Now here I obviously made it public so others can use but inside the text I made private the actions of the “player” so it acts like the way it is. I created 6 privates because it that how many you need in order for the “player” to act. I inserted another public inside the text for the image size. The 2 numbers that I chose, (46, 34) are a perfect size for the “player” and has been tested and it is able to go through the gaps of the pipes. Then finish it off for the public to have a go and close it off with the “}” to validate the whole code. Press compile to see if there are any mistakes and I only made 1 because I forgot a very common mistake which is “;”
The “public void act” is where the action is taken placed and inside the text there are many codes and i’m going to go through them because it looks a bit complicated. I made sure I put in brackets “space pressed” for the “player” to flap/jump through the pipes and I closed it with open and closed brackets and “{“ to make sure it is pressed by space bar. Now the location is put in a certain position so when you want to restart the game is “player” will be back into its normal position from the start. And now onto the pipes when it says “touching pipes = false;” its meaning when the “player” touches the pipes the “false” means when touched its blocked and gameover and the “player” is dead like said in the code “dead = true”. I then added the score when it goes through the pipes and onto the next it gives a score of 1 each time so you can see how much you scored and then obviously close it off.

(Image unavailable)

I also made a backup jump button just in case but I used the down arrow like in the box says “keyDown” which is known as the down arrow and I made it “true” and finished it off with “;” so its valid but I still have to confirm the space button so that’s why it is named “oldspace” and I put “true” so it’s also valid to work as jump. Then had to confirm for the return of the “player” after death to return to its normal place. I coded it after with x and y so it balances it out.

(Image unavailable)

I had to go to the score section to confirm and make sure the score works properly so i put in brackets “(0)” for public score so when everyone starts the game they will be on 0 score. With the numbers on the next text I put down “300,100” for the size of score and when fully compiled with no mistakes I dragged the score and placed it in the middle of the game. At the end I made sure that every time it goes through the pipe it goes up by 1 which is coded as “score+num” and num is add by 1.
Finally for the final confirmation of the pipes I fixed up the image size so it’s suitable to fit in the screen but kept the height the same so the “player can go through them. I set the location of where I want it to stay even whenI restart the game. Lastly, just close and compile everything and when done your game is complete and now can play!