denizkucukbalaban.files.wordpress.com€¦  · web viewmy scrolling platformer game is going to be...

26
Produce a design for a computer game for a given specification I will be demonstrating the plan and design for the game that I am going to create and I will do this by using graphic tools, narratives, action lists, flow charts, pseudo code and a storyboard. The first step of creating a game is the plan and design of the game and the reason why beginning with the plan and design is important is because it helps prevents mistakes in the later stages of the project and it is going to give an idea on how the game is going to be created and structured. Narrative I have decided to create a scrolling platformer game, a platformer game involves the player to control the in game character to jump onto platforms while avoiding obstacles and enemies, a scrolling platformer is a type of platformer however a scrolling platformer is where the camera moves along with the in game character. My scrolling platformer game is going to be based in a desert and the protagonist is going to be an armoured ninja that throws ninja stars, the ninja stars are going to be used to eliminate enemies. I am planning to have two enemies and an obstacle, a cactus that stays stationary and another enemy that moves from left to right then right to left repeatedly and the obstacle is going to be spikes. There is going to be a lives system where the player starts with three lives but when the player hits the enemies or obstacle, the lives counter will reduce by one and when the lives counter is equal to 0, I want a game over screen to be displayed. Also, there is going to be a score system where the player picks up an emerald and each emerald increases the score counter by one. To complete a level, I want to player to go through a portal and when the player goes through the portal, I want a level completed screen to be displayed. Graphic Tools To make my game look professional I am going to get some of the graphics for my game from a website called https://opengameart.org and this website provides graphics material for games. If I cannot find everything on that website, then I will be using Google Images to find graphics material for my game.

Upload: others

Post on 19-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Produce a design for a computer game for a given specification

I will be demonstrating the plan and design for the game that I am going to create and I will do this by using graphic tools, narratives, action lists, flow charts, pseudo code and a storyboard. The first step of creating a game is the plan and design of the game and the reason why beginning with the plan and design is important is because it helps prevents mistakes in the later stages of the project and it is going to give an idea on how the game is going to be created and structured.

Narrative

I have decided to create a scrolling platformer game, a platformer game involves the player to control the in game character to jump onto platforms while avoiding obstacles and enemies, a scrolling platformer is a type of platformer however a scrolling platformer is where the camera moves along with the in game character. My scrolling platformer game is going to be based in a desert and the protagonist is going to be an armoured ninja that throws ninja stars, the ninja stars are going to be used to eliminate enemies. I am planning to have two enemies and an obstacle, a cactus that stays stationary and another enemy that moves from left to right then right to left repeatedly and the obstacle is going to be spikes. There is going to be a lives system where the player starts with three lives but when the player hits the enemies or obstacle, the lives counter will reduce by one and when the lives counter is equal to 0, I want a game over screen to be displayed. Also, there is going to be a score system where the player picks up an emerald and each emerald increases the score counter by one. To complete a level, I want to player to go through a portal and when the player goes through the portal, I want a level completed screen to be displayed.

Graphic Tools

To make my game look professional I am going to get some of the graphics for my game from a website called https://opengameart.org and this website provides graphics material for games. If I cannot find everything on that website, then I will be using Google Images to find graphics material for my game.

Enemies and Obstacles

Blocks and Objects

Background

Sprite and Ninja Star

These are the graphics that I have found and I am planning to use these for my scrolling platformer game. Although I have found the graphics that I want to use for my scrolling platformer game, all the graphics are not the correct sizes and some of the graphics I found had a background. To resize some of the graphics and to remove the background of some graphics I decided to use a software called Adobe Photoshop.

This is an example of me using Adobe Photoshop to smooth out the cactus enemy and to remove unwanted pixels using the pen tool. The black outline on the image was used to spot the unwanted pixels, after the unwanted pixels were removed I also removed the black outline.

Action List

Action

Effect

User presses “W” key

The sprite jumps

User presses “A” key

The sprite will move to the left

User presses “D” key

The sprite will move to the right

User presses space bar

The sprite will shoot a ninja star

User collects emerald

The score counter will be incremented by one

User hits an enemy or obstacle

The lives counter will decrease by one and the sprite will respawn

User enters portal

Level completed will be displayed

Flow Chart

START

MOVE SPRITE

NO

TOUCHES ENEMY OR OBSTACLE

NO

YES

RESPAWN SPRITE AND DECREASE LIVES COUNTER BY ONE

NO

LIVES COUNTER EQUALS TO ZERO

YES

DISPLAY GAME OVER SCREEN

SPRITE ENTERS PORTAL

LEVEL COMPLETED

YES

Storyboard

Scene: Game Over

Scene: Game

Scene: Level Completed

Pseudo Code

Pseudocode is a set of instructions which helps to plan and design a program which is close to the English language.

IF the “W” key is pressed then move the sprite upwards

ELSE IF the “A” key is pressed then move the sprite to the left

ELSE IF the “D” key is pressed then move the sprite to the right

ELSE IF the “Space” key is pressed then shoot a ninja star

IF sprite touches an enemy or obstacle then decrease lives counter by one

IF lives counter is equal to 0 then display game over screen

IF sprite collects an emerald increase the score counter by one

IF reset is clicked then reset the level

IF start clicked then start the game

This is an example of the pseudocode for a part of my program, when I move to programming the game it will be useful referring back to the pseudocode since it is simplified and it will give me an idea of how the actual code will look like.

Determine appropriate data types for a computer game and show how they are declared

Type

Definition

Example

String

A string is a combination of characters and they are declared within speech marks.

“Hello World!”

Character

A character can be either a letter, number or symbol.

a

Integer

An integer is a whole number that is positive or negative.

10

Float/Real

A float/real data type is a decimal number but it can also be an integer.

0.5

Boolean

A boolean is a true or false statement.

True

Data Types

This image is from my sprite class and these variables are all integers, these variables are used to make the sprite functional by being able to make it move and to control how high the sprite can jump and how fast it will fall back down to the ground.

This image is from my lives class and this class creates a lives counter and the “lives” variable is an integer which shows how many lives the player has and the variable is subtracted by one if the sprite touches an enemy or obstacle. Also, in the updateImage() method, a string and an integer is combined to create the lives counter which shows that in some scenarios two variables with a different data type can work together.

This image is from my sprite class and these variables are all booleans, these booleans are used to check certain functionality and they are mainly a part of selection statements such as if and else if. For example the facingRight variable, this boolean variable is used to check whether the sprite is facing towards the right, if the sprite is facing right the moveRight() method is called and if the sprite is facing left the moveLeft() method is called.

Explain how the structure and design of a game can assist in maintenance and capacity for extension

Comments

Comments are notes to explain the source code of a program and they don’t affect how the program functions. Comments are important for maintenance and the further development of a program because it will help a developer understand what the program does and how it works. Also, making changes to a program will be easier if the source code is commented adequately because the developer will be able to find what they need to do to be able to add or change code. Furthermore, debugging and fixing bugs will be simpler when the source code is commented because the developer will be able to find and fix errors and bugs easier since the code is clear and annotated. I have commented the source code of my game as it helps me remember what section of code carries a specific function, also it helps me remember what the source code does after not looking at the source code for a while. The image above shows a part of my game where the source code is fully annotated.

Variable Names and Naming Conventions

A variable name is supposed to give an idea of what the variable does and this will enable for maintenance of the program and further development because the developer will understand what the variable does and what it is used for by the name of the variable. The same principle applies for method names and class names, having a method and class name that describes what the method or class does is useful because it will help a developer have an idea on what the method or class does and what relation it has to the rest of the program. Also, having helpful variable names, method names and class names will reduce the need to excessively comment the source code as the variable names, method names and class names will describe what the variable stores, what the method does and what the class does. The image on the right is all of the class names for my game, most of the class names explain what the class does a part from “block2” which I believe I could change to “groundBlock” since it gives more detail on what the class is about.

Spacing and Indentation

Spacing and indentation is a crucial part of the layout of the source code and the purpose of spacing and indentation is to make the source code of the program readable and clear. Furthermore, having source code that is consistently spaced out and indented properly will make maintenance and further development of a program easier because the developer would be able to find what they are looking for since the source code is organised. Sometimes indenting incorrectly could cause errors in a program therefore indenting correctly would also reduce the possibility of an error occurring. The image shown below is a section of source code from my game, the methods are spaced out and everything is indented correctly.

Modularisation

Modularity is the process in which large code is split into segments of smaller code and the smaller segments of code are connected together to create a program. The purpose of modularisation is to remove repetitive code and this is achieved by having smaller segments of code and each segment contributes to a certain function or action in the program therefore whenever a certain section of code needs to be repeated, a method can be called instead of copying the same block of code. This improves the simplicity of a program because unnecessary code is eliminated which makes the overall code clearer and understandable. Modularisation will assist maintenance and enable further development of a program since removing repetitive code makes the program consice which will make the code readable for a developer, also having shorter code is beneficial because there is a lower likelihood of running into bugs and errors. If a developer would like to make changes to a program, modularisation would make it a simpler task for the developer since the program would be organised and the developer could call a method to reuse code to develop the program instead of repeating code which is not efficient.

This is an example of modularisation used in my game, getLives() is a method in myWorld() class and the purpose of the method is to call the lives() class when the game is started or restarted.

Syntax and Semantics

Syntax are the rules within the programming language, I used the Greenfoot IDE which uses Java to create my game and in Java after almost every line a semicolon is placed. With methods, if statements and loops it is required to have curly brackets to hold whats inside the method if statement and loop. These two examples are the syntax of Java and understanding the syntax of a programming language is important for maintenance and further development of a program because the developer wouldn’t run into syntax errors and changes could be made if the developer knows the syntax of that programming language.

Semantics is if code is placed in the correct place for example if I put my lives code in the score class, technically the program would function however for further development and maintenance it will be confusing for the developer to find what they are looking for and to make changes to the code.

The image above is the source code for the score class in my game and it has correct syntax and semantics, the rest of my game also has correct syntax and semantics.

Develop a computer game for a given specification

To create my computer game, I will be using the Greenfoot IDE which uses Java and the Greenfoot IDE makes it simple to create a game because it has a user friendly graphical user interface. I will create my computer game based on my plan and design that I created at the beginning of this project. You will be able to play my game and look at the source at this link: https://www.greenfoot.org/scenarios/23210

So I began my game by starting with the background, so I set the dimensions of the world to 1300x860 and set the image of the MyWorld() class to the background of my choice. After the background, I worked on the ground block and this is the block2() class. I set the image of the block2() class with the image of my choice however it was large so decided to use a software called Adobe Photoshop to make the ground block a reasonable size. Once the ground block was resized, I worked on the sprite which is the protagonist of the game and I set the image of the sprite to the image of my choice then I worked on the movement of the sprite.

The image above is a part of my sprite() class and this is the checkKeys() method within the class and this method allowed the sprite to move and I had you use multiple if statements to check what keys the user was pressing on the keyboard. I wanted my game to use the W, A and D keys for movement instead of the arrow keys because the arrow keys are hardly used in games nowadays. The “W” key allows the sprite to jump, the “A” key allows the sprite to move to the left, the “D” key allows the sprite to move to the left and the space bar allows the sprite to shoot ninja stars to be able to eliminate the enemies along the level.

After working on the sprite and the movement function of the sprite, I worked on the sprite recognising the ground block and be able stay on top of the ground block instead of sinking through.

So the onGround() and moveToGround() methods are both in the sprite() class, the onGround() method enables the sprite to recognise the ground block and the moveToGround() allows the sprite to be on top of the ground block instead of sinking through.

Next, I worked on placing the ground blocks to the world and at first I manually placed the ground blocks to the world however I realised that this was not the most effective way because some of the ground blocks were not placed precisely so my solution was to use loops.

The image above is from the MyWorld() class and the levelOne() method is the method where I added all the objects to the world. So the for loop placed the ground blocks horizontally at the bottom of the screen by using a range for the x and y coordinates. Also, I added the sprite to the world using x and y coordinates.

Then, I worked on an obstacle which was the spike so I set the image for the spike and in the sprite() class I created a method called checkObstacles() and this method ensures that if the sprite is touching an enemy or obstacle that it would make the sprite respawn. Also, I added the spikes to the world using a for loop similarly to the ground block.

Until this point, this is how my game was looking however since I wanted my game to scroll I researched how to make the scrolling functionality for my platformer game so I began with creating the Scroller() class.

This image above is the source code for the Scroller() class and overall how it works is when the sprite moves in a direction the camera will move along with the sprite in that direction.

Next, I worked on creating the platform block that my sprite will be able to jump to so the name of this class is called boxPlatform() and I set the image of boxPlatform() to the image of my choice and I made it so boxPlatform() inherits all of the functionality from the block2() class by making it a subclass of block2()

When I added the platform block I needed to make the sprite not to be able to jump through the platform block from the bottom and the side so these series of methods in the sprite() class enables the sprite to recognise the platform block and stop the sprite from travelling through the side and from the bottom of the platform block, the bopHead() and stopByRightWall() methods create a barrier around the sides and the bottom of the platform block and the sprite hits the bottom or side of the platform block and will fall back down to the ground.

After working on the platform block I decided to create my two enemies so the first enemy was an enemy that was going to move a couple steps to the right then move to the same amount of steps to the left and then move to the right again and this would repeat.

This is the Enemy() class and it uses a counter and if statements to achieve the movement.

The second enemy is a cactus enemy and it is going to be stationary however when the sprite hits either of these enemies they would respawn but later on I create a lives counter so whenever the sprite hits an enemy or obstacle it will lose a life.

Next, I decided to create the ninja star that the sprite would shoot to eliminate the enemies so when the player clicks the space bar key it would shoot a ninja star and I created two classes called shruikenRight() and shruikenLeft() so whatever direction the sprite is looking at, the ninja star will be launched in that direction.

The image above is from the shruikenRight() class and overall when the ninja star hits an enemy, the border of the world or the platform block the ninja star will be removed.

Finally, I created the score and lives counter, the coins, game over and level complete screens and a portal. So I created the coins which look like emeralds and whenever the sprite is touching the coins it will increment the score by one and remove the coin. When the level starts, the lives are set to 3 lives however when the sprite hits an enemy or obstacle, the lives are subtracted by one and if the lives are equal to 0 then the game over screen will appear. The portal is the object at the end of the level and if the sprite touches the portal without reaching 0 lives then the level complete screen will appear.

Use appropriate selection and iteration methods for a computer game

Selection

Selection in programming is where a decision is needed to be made to move onto the next step of the program and in Java, the most common syntax used for selection is if, else if and else statements.

An example of an if statement taken from my game is if the sprite is touching the portal then display the level completed screen, the else statement is not needed here because if the sprite doesn’t touch the portal then the game will just continue.

An example of an if statement followed by an else statement taken from my game is if the sprite is touching an enemy or an obstacle then decrease the lives counter by one, make the sprite respawn and change the touchingObjects variable from false to true. If the sprite is not touching any enemies or obstacles then keep the touchingObstacles variable as false.

Iteration

Iteration in programming is where an algorithm is repeated and there are two different types of loops, for loops and while loops. The difference between a for loop and a while loop is that a for loop is used when the number of iterations is known however a while loop is used when the number of iterations is unknown.

I only made use of for loops in my game because I didn’t need to use a while loop however this image is a for loop that horizontally repeats the placements of the ground blocks at the bottom of the screen within a certain range. The for loops were used similarly in my game with other objects and I used the for loops to place the same object across a x any y range.

It is evident that I have used selection and iteration methods by looking at the source code of my game and you can look at the source code of my game to look at more selection and iteration methods at this link: https://www.greenfoot.org/scenarios/23210

Follow a test strategy to test and debug a computer game and use a variety of testing tools

White Box Testing

The white box testing method is where the person testing the program knows the source code of the program. The benefit of white box testing is that since the person testing the program knows the source code of the program, if an error occurs they would have an idea where the problem could possibly be occurring. White box testing is used to see if the program is functioning correctly and the structure of the program. The disadvantage of white box testing is that feedback couldn’t be retrieved for maintenance and further development of the program.

Black Box Testing

The black box testing method is where the person testing the program doesn’t know the source code of the program. The benefit of black box testing is that since the person testing the program doesn’t know the source code of the program, the developers will get the perspective of the users. Black box testing is mainly used to see if the program is functioning correctly and it can be used for maintenance and further development because feedback could be given on what the developers can improve about the program.

What is being tested?

Expected

Outcome

Actual

Outcome

Action

Taken

When the “D” key is pressed, does the sprite move to the right

The sprite to move to the right

The sprite moves to the right

No action required

When the “A” key is pressed, does the sprite move to the left

The sprite to move to the left

The sprite moves to the left

No action required

When the “A” and “D” key is held at the same time, stop the sprite from walking

Stop the sprite from walking when the “A” and “D” key is held

The sprite stops when the “A” and “D” key is held at the same time

No action required

When the “W” key is pressed, does the sprite jump

The sprite to jump

The sprite jumps

No action required

When the space bar is pressed, does the sprite shoot a ninja star

The sprite to shoot a ninja star

The sprite shoots a ninja star

No action required

When the space bar is held, does the sprite repeatedly shoot a ninja star

The sprite to not repeatedly shoot a ninja star when the space bar is held

The sprite doesn’t repeatedly shoot a ninja star, it shoots a single ninja star then stops shooting a ninja star

No action required

When the ninja star hits an enemy, remove that enemy

Remove an enemy when it is hit with a ninja star

Enemy is removed when hit by a ninja star

No action required

When the sprite touches a coin, the score counter increments by one and the coin is removed

The score counter increments by one when the sprite touches a coin and the coin is removed

The score counter increments by one when the sprite touches a coin and the coin is removed

No action required

When the sprite touches an enemy or an obstacle, the lives counter decreases by one and the sprite respawns

The sprite respawns when it touches an enemy or an obstacle and the lives counter decreases by one

The sprite respawns when it touches an enemy or an obstacle and the lives counter decreases by one

No action required

When the lives counter is equal to 0, the game over screen should be displayed

The game over screen is displayed when the lives counter is equal to 0

The game over screen is displayed when the lives counter is equal to 0

No action is required

When the sprite enters the portal, the level complete screen is displayed

The level complete screen is displayed when the sprite enters the portal

The level complete screen is displayed when the sprite enters the portal

No action is required

User Feedback

User

Suggested Improvement

Action Taken

Siddhant

“The sprite image is too big and the movement speed of the sprite is too slow”

I have made the sprite image smaller by using a software called Adobe Photoshop and in Adobe Photoshop I went to File > Export > Save for Web (Legacy) and changed the image size and saved it then imported it into my game.

In terms of the movement speed of the sprite being too slow, in the sprite() class I increased the number stored in the speed variable.

Sean

“When the sprite throws a ninja star at any coin, it would get rid of the coin when it shouldn’t”

Instead of the shruikenRight() and shruikenLeft() being a subclass of the sprite() class. I extended both shruikenRight() and shruikenLeft() classes to Actor() instead of sprite() and now the ninja stars don’t interfere with the coins

James

“Add a portal at the end of the level, when the sprite goes through the portal display a level completed screen

No action required

Twistios_Player

“Add more enemies, consider adding enemies that require multiple hits to defeat”

I believe that this suggested improvement is a large improvement therefore if I choose to further develop the game then I would take this improvement into consideration

Nolttr21

“The hitboxes are little too big, but I like it!”

No action required

Produce user documentation for a computer game and produce technical documentation for a computer game

User Documentation

The scrolling platformer game that I have created can be played on the Greenfoot website and on the Greenfoot website where my game is posted, you can download my game and run it on the Greenfoot IDE which you can install on Windows, Mac and Linux. I was inspired by Super Mario and that is the main reason why I chose to create a scrolling platformer game and another reason why I wanted to create a scrolling platformer game is because I wanted to challenge myself to make an advanced game in which I have achieved and I have learned a lot from creating my game.

To operate my game, the user requires to have a computer that is capable of running my game off the Greenfoot website or downloading the Greenfoot IDE and running the game from the Greenfoot IDE. Additionally, the user must have a keyboard and mouse to be able to run and operate the game.

W

A

D

Space Bar

The aim of the game is to reach the portal at the end of the level without reaching 0 lives, you have to avoid the enemies and obstacles in the game to survive.

· The “W” key is to make the sprite jump

· The “A” key is to make the sprite move to the left

· The “D” key is to make the sprite move to the right

· When the space bar key is pressed, the sprite will shoot a ninja star

FAQ

Q: How do I play the game?

A: Use the “W” key to make the sprite jump, use the “A” key to make the sprite move to the

Left, use the “D” key to make the sprite move to the right and use the space bar key to

make the sprite shoot the ninja star.

Q: How do I complete the game?

A: All you have to do to complete the game is to go to the portal at the end of the level

without the lives counter reaching 0 and that is how you complete the game.

Q: How do I start the game?

A: If you are playing the game on the Greenfoot website to start the game you must click the

“Run” button to start the game. If you want to play the game on the Greenfoot IDE then on

the Greenfoot IDE click “Scenario” and “Open…” open the game and click the “Run”

button.

Q: How do I restart the game?

A: If you are playing the game on the Greenfoot website to restart the game you must click

the “Reset” button to restart the game however if you are playing the game on the

Greenfoot IDE and you want to restart the game you can also click the “Reset” button to

restart the game.

Technical Documentation

To be able to run my game you will need any of these operating systems:

· Windows 7, 8 or 10

· Mac OS X 10.10 or later

· Linux

You must have 1,873,312 bytes available on your system to be able to download the game but you would additionally need:

· 187MB to install the Greenfoot IDE on a Windows system

· 190MB to install the Greenfoot IDE on a Mac system

· 12MB to install the Greenfoot IDE on a Linux system

Also, my game was coded on Greenfoot version 3.5.3 so it is recommended to install Greenfoot version 3.5.3 to ensure that the game works.

To install my game you must:

· Install the Greenfoot IDE and the Greenfoot IDE can be downloaded at this link: https://www.greenfoot.org/download

· Once the Greenfoot IDE has been installed, open this link on your web browser: https://www.greenfoot.org/scenarios/23210

· Click on the “Open in Greenfoot” button and this will begin to install the game

· Once the game is installed open the Greenfoot IDE and click “Scenario” and “Open…” open the game that you previously downloaded

If you want to play my game on the Greenfoot website then all you have to do is go to this link and the game should be loaded into the browser: https://www.greenfoot.org/scenarios/23210

Bibliography

BBC Bitesize (Not Dated) Data types and structures Available at: https://www.bbc.com/bitesize/guides/zghbgk7/revision/1 (Accessed 12 February 2019)

GeeksforGeeks (Not Dated) Concept of Comments in Computer Programming Available at: https://www.geeksforgeeks.org/concept-of-comments-in-computer-programming/ (Accessed 12 February 2019)

Mrbool.com (Not Dated) Importance of code indentation Available at: http://mrbool.com/importance-of-code-indentation/29079 (Accessed 12 February 2019)

BBC Bitesize (Not Dated) Selection Available at: https://www.bbc.com/bitesize/guides/zy3q7ty/revision/1 (Accessed 13 February 2019)

Mason, C (2014) TECHINCAL GUIDE FOR RISE OF CTHULHU Available at: https://docs.google.com/file/d/0B-piPy-ZUCR6VmdtUWRncWNlRTQ/edit (Accessed 13 February 2019].

Areola, M (2014) Test Plan Available at: https://drive.google.com/file/d/0BxuIQbHA0kQuTThUeEFvT0ZJR2c/edit (Accessed 13 February 2019)

Techopedia.com (Not Dated) Iteration Available at: https://www.techopedia.com/definition/3821/iteration (Accessed 13 February 2019)

Software Testing Fundamentals (Not Dated) Differences Between Black Box Testing and White Box Testing Available at: http://softwaretestingfundamentals.com/differences-between-black-box-testing-and-white-box-testing/ (Accessed 13 February 2019)