14
Workflow This workflow will document the process,thoughts and ideas of creating a 2D Side Scrolling Shooter Game. In this task I will be using GameMaker to create my game, so i will explain the process of creating a game using GameMaker software. Ideas My idea for the game is to create a 2D Side Scrolling Version of the game Space Invader from the perspective of the Alien, The game will use influences from other things that involve space as my game will be set in space and the storyline will be, your an alien which fights other things such as other aliens and human space crafts. The first boss in my game will be a borg cube from star trek. I want my end game to be a quirky fun little game with many references from other media that people that play the game will understand. http://t1.gstatic.com/images?q=tbn:ANd9GcRnc8xF-YdFM-QofXX-PPpK-iLkWqdxBBBbKZZe0zHXf2qM9Nt4CAhttp://t1.gstatic.com/images? q=tbn:ANd9GcRnc8xF-YdFM-QofXX-PPpK-iLkWqdxBBBbKZZe0zHXf2qM9Nt4CA http://fc05.deviantart.net/fs12/i/2006/311/5/f/2D_Background__Space_by_Sheona_Stock.jpg

Workflow 13

Embed Size (px)

Citation preview

Page 1: Workflow 13

Workflow

This workflow will document the process,thoughts and ideas of creating a 2D Side Scrolling Shooter Game. In this task I will be using GameMaker to create my game, so i will explain the process of creating a game using GameMaker software.

Ideas

My idea for the game is to create a 2D Side Scrolling Version of the game Space Invader from the perspective of the Alien, The game will use influences from other things that involve space as my game will be set in space and the storyline will be, your an alien which fights other things such as other aliens and human space crafts. The first boss in my game will be a borg cube from star trek. I want my end game to be a quirky fun little game with many references from other media that people that play the game will understand.

http://t1.gstatic.com/images?q=tbn:ANd9GcRnc8xF-YdFM-QofXX-PPpK-iLkWqdxBBBbKZZe0zHXf2qM9Nt4CAhttp://t1.gstatic.com/images?q=tbn:ANd9GcRnc8xF-YdFM-QofXX-PPpK-iLkWqdxBBBbKZZe0zHXf2qM9Nt4CA

http://fc05.deviantart.net/fs12/i/2006/311/5/f/2D_Background__Space_by_Sheona_Stock.jpg

Page 2: Workflow 13

Sprite

The first thing I created for my game was my main sprite, sprites are a the bitmap based images that GameMaker uses for the graphic. As my idea for my game is a parody of Space Invaders my main characters for the game as already stated is going to be an Alien from Space Invaders, I used a basic version of one of the aliens from

space invaders as a template, only changing the colour of the eyes to add a little variation. I created this sprite by using the sprite editor that was already in GameMaker. After creating the design for my sprite I set the origin to centre, this makes it so that anything I code for the sprite will effect from the centre of the sprite, for example when

i code movement it will move from the centre of the sprite. I then set the collision mask to eclipse so it covers more of the sprite so the coding will be more pixel precise when coming into contact with enemy projectiles. I named my player sprite “Player_spr” because its very important to name things properly in GameMaker because everything

has to be unique because when it comes to coding you cant have 3 things all called the same thing, so for all my sprites I will use “spr” short for sprite after the name. After creating my background later on for my game i discovered that the design of my sprite was not equate as the background is also black the only visible thing of the sprite was the eyes, so i went back and added a white line outline of the Alien so it would stand out from the background and is easier to see.

Object

Next I created the player object, an object in gamemaker is something you use to code the behaviour of the object onto. You create a sprite which is what the particular thing your coding looks like, for example my main sprite, then you create an object which what you use to code the behaviour of the main sprite, for example how it moves in game or what rate it fires bullets.

The first thing i did was the select the sprite for my object which is my Player_spr, I then set the different parameters, which i checked solid, which enables the collision mask to work, and visible so you can see the player. I left persistent, which makes something

Page 3: Workflow 13

visible through all the levels in the game, and physics, which applies physics to the object as I wont have to deal with them yet in making this game. The next thing I did was to code the movement for the player object, I did this by creating an step event for the object, an event is something that triggers other things to happen, a step event is something that will happen every step/ frame of the game. I then began to code the movement of the game, the first thing I did was to put a hint but using “///” which changed the colour of writing to green to show that this is not part of the code. Hints and very useful when for later if I did to come back and fix any of the code I will know which bits are for what by looking at the hints as the hints tell me what part of code do what in the game. I then began to code the movement, I did this by writing the code “vk_up” which means vertical keyboard up. So whenever the up button is pressed the player will move up on the screen, I then copied and pasted the code for this but changed the the code for the direction i wanted the object to move, for example i changed up to down when i wanted the player object the move down. I also changed the X and Y for the different directions so the player object will move in the correct direction as intended.

Rooms

To control my player, its needed to have a level for it to move about it. So i created my first room which is my level, to do this i created a new room called “Level!” i set the width and height to 1024 and 576. I made the background black at first because my game is set in space, and then I set my player object in the room so when the level loads it will load with the player object. After testing my game i realised i couldn't see the player sprite so I played around with the background, making it different colours to try and resolve the issue but i didn’t like any other colour as much black for the background so I ended up editing my player sprite so it would stand out in front of the black background. I also made movement limits for my room, this means that the sprite cannot move higher than the boundaries that I coded. I did this so when the sprite is being moved around by the player it will not go outside the boundaries I set which are the borders of the room so the sprite will not go outside the screen.

Page 4: Workflow 13

Scrolling background

Next I created a scrolling background for my game, previously i had created a background but that was just for testing purposes, now I am creating a background which moves to the left so it gives the impression that the character is moving to the right through the room which is just on a loop or a background I will create. My game is set in space so my background is going to be space, I created the first background which is a black background with a few stars and a moon in, after I did this i created a second background which had a transparent background and more stars on, I did this because once the second background will overlap the first background as its transparent it will just add more stars, however I am going to set the first backgrounds hspeed to -6 which will make the it move to the left and then I set the second background hspeed to -7 which will make the transparent stars move slightly quicker than the background to the left which will give the impression than the player is moving through space. However I had a few problems i had to fix after i had created both backgrounds as the width was set to 1024, while it was moving it was showing the moon twice in one frame, as I wanted it to run smoothly i changed the background width to 2000 so the moon wasn’t shown twice so it set a clearer and smoother background . The final product is shown to the right.

Particle System Effect

The next thing was to create a particle system effect, which is a special effect system that game maker has which emits little particles and just completes the effect. I wanted to use the particle system effect to create the effect of a jet coming from behind my sprite, to do this I first created a new sprite and named it Thrust_ it is just a couple of pixels shaped into a circle, as you can see on the right. I then had to code the thrust sprite to do as I intended. I wanted a trail of them coming off the back like a Jet effect, to do this I had to code; I first created a new event and clicked step, I then started to code, to make the movement how I wished it to be, I had code the object, which is jet because it has different parts, In the next line I had to code what part I wanted it to effect which is part 1, as it only does one thing I closed the bracket. The next line is what part type it is, this part type is a sprite. I then had to specify other things but as I didn’t want to animate, stretch or playback all of these are false. If you don’t put in the arguments then the code won’t work. I then used a function called part size and this just determines what size it is, it has a minimum and maximum size it will be generated at but as this is just an thrust effect I didn’t want them to be too big. The

Page 5: Workflow 13

last parameter is wiggle but as I didn’t want it to change in size I left it at 0.

Next is the function part life, and this controls how long the particle lasts long for, I set it at 300 frames.After this I coded the function part type gravity, this creates a gravity effect on the particle, as I wanted it to be quite different I put a random range on it so it isn’t a constant speed. I then I had to code which way I wanted the effect to take place. The last part type alpha, dictates how visible the particle is, weather it’s opaque or transparent so I set it at a random range. The last thing I did was to set the depth of the particle, as my sprite is at the depth of 1 I set the particle depth at 2. The last thing I coded was the position of the particle, I set it so It was underneath my sprites foot, so it looked like it was coming out the back.

However after i tested out the particle effect i did not like the look of it, I moved the jet effect around on the body of my sprite but it didn’t suit the style of my sprite as you can see on the right it doesn’t look quite right. (this is an old screen shot when I was also messing around with the player sprite to get the right colour because it was originally black and could not been seen on top of the background however as I did not keep the particle system in my game i can not retake the screen shot) so i decided not to use the particle system effect. I included how i did the particle effect in my workflow as it took quite a while to do and I wanted to show evidence that I can use the particle system effect but I choose not too.

Player Projectile and Sound

Page 6: Workflow 13

As I now have a room and a player the next thing i needed to create was a player projectile, which will be a an a

small laser, which is just a very bright shade of green inside a circle of blue inside a light shade of white. I then

set the origin to centre. I then created the laser object. Next i started to code, the first thing i did again was to

create a event, an create and event and then i began to code. I wrote an hint again and then used the function called “hspeed” which controls which way the object moves, its an positive value which means when its in the plus numbers it'll go left to right and when its minus it’ll go right to left. As i wrote “hspeed 20” it’ll move left to right at the speed of 20. The second thing i needed to do was to make it so the laser is destroyed as soon as it leaves the room, otherwise is they laser isn’t destroyed it’ll build up to many of them and the game will crash, to do this i created a step event so this will do what i code every step of the game, i then again gave it a hint, and used an if statement; “if x > room_width {instance_destroy()}” what this does is when the laser (x) leave the the maximum value of the room width it is destroyed. The next thing I need to do was to create the code to fire the laser from the player. So i had to go to the player object and go back into the movement code, i put in a new hint “shoot” so i know that the next bit of code is for the player shooting not the movement of the player. I used a new if statement “if keyboard_check_pressed” this means that it will only send a positive value whenever the keyboard is pressed, so the player will only fire the laser when the keyboard is pressed and will stop after its been pressed once. So you have to press the keyboard multiple times for it to continue firing. I then carried on the code with “(vk_enter) { instance_create(x, y, player_laser);” which means when whenever the enter button is pressed the laser is created and fired from the players position in the room. After i tested this i decided that it needed some sound, this is the first time im putting sound into my game and i wanted the sound effect to go with the laser look, so a laser sound so I found a sound that was suitable for my laser sprite of the internet and downloaded. I then opened it up using game maker and names it “zap1” i then had to code it so whenever the laser fired the audio will play. Underneath where i had coded for the player laser movement i wrote “audio_play_sound(zap1, 1, false) which means it will play the sound zap1 and not loop.

Page 7: Workflow 13

.

Animated Enemy Sprite

Now i will create an enemy that the player can shoot at. For this i decided that i wanted to animate it, to do this i created 4 frames of the same design of my enemy which is a red ball. The animation shows an eye rolling backwards so essentially the red ball is a eye ball and you shoot alien eye balls in space. After i was finished i centred the origin again and changed the collision mask to eclipse. Now that iv created my enemy sprite i need to code the enemy, so i created an

Enemy Object Spawner and Movement

So as i have made my enemy sprite the next thing i need to create is the enemy spawner which will spawn enemy's into the room. To do this i created a 2 new object called enemy1 and system. The system object is really just a place to keep things like the enemy spawner and the later on a health damage system. The first thing i did was to code the enemy spawner, to do this i created an alarm 0, an alarm in gamemaker is like an alarm clock and after you set the a certain amount of frames it will go off. I then wrote in the code of the alarm a hint, then “randomize();” this will generate enemy's randomly to give variation, “var y_spawn;y_spawn= random_range(32, 448)” what this piece of code does is set the spawn place for the enemy. So when the alarm goes of it will generate the enemy anywhere between 32 and 448, then i need to create the instance of the object i did this by writing “instance_create(1140, y_spawn, enemy_1)” what this does is create the

Page 8: Workflow 13

enemy anywhere on the Y axis but out of the room, as the room width is 1020 and i set the instance create function to 1140, this means the enemy will spawn outside the room. As i wanted to create it so that the waves of enemy’s are in a triangular pattern i copied and pasted the instance create code but changed the spawn point; “instance_create(1040, y_spawn+64, enemy_1);” here you can see i changed the spawn point to 1040 which is still outside the room and added 64 pixels to the Y spawn do it will spawn below the first enemy. I did the same for the third enemy but changed again the spawn point and Y spawn; “instance_create(1140, y_spawn+128, enemy_1);”

Lastly I added another hint which is reset alarm i wrote “ alarm[0] = random_range (90, 120);” what this will do is between 90 and 120 frames the alarm will reset. So the alarm will go off and create 3 enemy's then reset and create 3 more enemy's randomly

Now that my alarm is created i need something to set the alarm off, i did this by creating an create event and writing; “alarm[0] = 30 “ what this does is that every 30 frames it will create the alarm again allowing the alarm to create enemy’s randomly. Now the last thing to do for the enemy spawner was to place it in the room so that it will load up in the room.

Next i began coding the behaviour for the enemy, which in this case is the movement; “hspeed = -10 image_speed = 0.5 alarm[0] = 20” using the hspeed which is a negative value this time which means it will go right to left, the image speed is the speed of the animation of the sprite and lastly the alarm will go of every 20 frames. Now that this is coded as i did with the player i needed to create an instance destroy once it leave the room i did this in the same way.

Page 9: Workflow 13

Enemy Destroyed By Laser

The next thing to do now that i have enemy’s in my game is to destroy them, this is very simple to do but first i set up the particle effect for the death of the enemy which is just 4 frames of an explosion, which is just a circle changing colour, i centred the origin like usual then created an object for the explosion

Page 10: Workflow 13

I then created the object “explosion1” and created a step event in which i wrote code for the particle system as i have already explained the particle system previously i copied and pasted the code and only changed the gravity to be a random thing and the creation point to x,y so when the enemy sprite dies the explosion will happen where the enemy sprite is. Next i wanted to stop the particle effect i did this by creating an alarm that will stop the instance of the explosion by using the function “instance_destroy();” Lastly i created an create event to set my alarm so when the enemy sprite changes into the explosion it will only last for a certain amount of time which i set to 5 frames. I decided that i wanted to create a sound and i did this exactly

the same way as i added the laser sound but this sound was a blast. Next i needed to set up the collision with the enemy player laser so when the enemy sprite comes into contact with player laser it changes into the explosion. To do this i went into the enemy1 sprite and added and collison event and selected the object that it is going to come

into collision with which is the player laser, and added a bit of code; “ instance_change(explosion1, true); global.points +=1” what this bit of code means is that the instance will change into the explosion, and the second argument if whether it preforms the codode in that object code which I wanted it to do so i set it to true so it preforms the code the last bit of code is for when i make a points system, which i will explain later but that code makes its so once one enemy is killed the score increases by one point

The last thing to do for destroying the enemy was to make the player laser be destroyed as well so once it touches the enemy both of them are destroyed, i did the same way as i did for destroying the enemy but creating a collision event but using the drag and drop command this time which is quicker to use and does the same thing as i coded earlier.

Enemy Projectiles

Page 11: Workflow 13

So now i have a scrolling background, player and enemy, the enemy needs to fire back at the player. I did this by creating an enemy laser sprite which is just a little blue ball of light. I then created an enemy laser object and added an create event and began coding an if statement “ if instance_exists(player_1)” so if the player sprite exists then the laser will move towards the player corrdinates by using this code; “move_towards_point(player_1.x, player_1.y, 15);” and lastly for this code it will play a sound, using the same code i used for the other sounds. Next i created an collision event so when the laser comes in to contact with player it will destroy the instance of the

player. Also as i did with the player laser i added a create step event which was to destroy the instance once it goes outside the room.

Finally i made the enemy object shoot, by creating an alarm event in the enemy object code and wrote; “if instance_exists(player_1){instance_create(x, y, enemy_lazer);alarm[0]

= 20}” which means if the player instance exists it will create the enemy laser which will move towards the players coordinates and will fire every 20 frames. Lastly in the create event i added “alarm[0]” which means whenever the instance is created the alarm will reset.

Shield Variable

The shield variable is the health in my game. So for the shield variable i coded in the system; “globalvar shield ;shield = 100;” which means the shield = 100 which means the player has a 100 points of health and once they are depleted they player instance is destroyed. To do this i had to go back into the enemy laser so it when the enemy fired at the player and the player was hit it would decrease the shield by 25 until the shield reached 0 and then the instance would be destroyed. With this working i when make and created another event in the system which was draw, and set it so it would draw the shield by writing the code “draw_rectangle_colour( 32, 32, 32+global.shield, 40, c_red, c_red, c_red, c_red, false);” which means whenever the room loads it will draw a red rectangle in the upper left corner and when the player is hit by the enemy laser it will deplete the bar by 25 points.

Page 12: Workflow 13

Player Destroyed

The next thing i did was to create the player being destroyed i did this exactly the same why i did for the enemy being destroyed, i only changed the explosion particle effect and when coding i changed the names and some variables but i used the same method as i did when making the enemy explode. I also added in an explosion sound that plays when the enemy dies. I did this the same way as i have explained before.

Score System

As i mentioned before i now am adding a scoring system which is when the player shoots the enemy and kills an enemy the score increases by 1. I did this by using the code; “globalvar points;points = 0;” this bit of code does as i explained and when the room first loads the you start out with 0 points and as you kill more enemy’s the points increase. i then added a draw event so the game will draw the score by using the code; “draw_set_font(font1);draw_set_colour(c_white);draw_set_halign(fa_center);draw_text(36,40, global.points);” which means the game will draw the score underneath the health bar in the colour white. Then to make the score increase by 1 every time an enemy is shot i used the code “global.points +=1”

Enemy 2

I nearly have a finished game, i thought i would add a second enemy to make it a little harder and to add some variation, i did this by using the first enemy code as a base and only making some slight

Page 13: Workflow 13

alterations, as i have already explained enemy’s 1 code i will just explain how i made enemy 2 different. First of all i created a new sprite and added some animation to make it flash. It is just a triangle which flashes, as the first enemy is a circle i thought i would keep to basic shapes and enemy’s. I then created the enemy laser which is a double barrelled laser which fades in colour.

My first enemy’s laser follows the player as it shoots at the players coordinates, i didn’t want to make my game too difficult so i made it so the player shot straight ahead instead of at the player. I also changed the movement of enemy 2. As enemy 1 stays still i made it so enemy 2 moves up and down and is randomly spawned but instead of 3 enemy's only 1 enemy is spawned

Music and Screens

The last things i had to do for my game was to add in background music, start screen and game over screen. I started with the start screen, for this i made a background of falling meteorites to tie in with my space theme, i wanted it to be so there was a button which said “start” which you clicked which would take you to the game. To do this i had to make a new room, with the background i just created and make a new sprite called which said “Start” to make this sprite i make the background transparent so it could go over the background of the start screen and used the text tool to write “start” in white, i then made that into an object and dragged it where i wanted it to be in the room. To make it work i had to code the start object to send you to the next room when left clicked.

I Then wanted to make a game over screen, i need essentially the same thing as i did for the start screen. Only making the game over screen black and with two button which say “game over” and “restart” i used an left mouse command again so once you click the restart button it takes you to the previous room which is the game.

Page 14: Workflow 13

The last thing i did was to add in music, for this i had created a space themed backtrack which plays in the game, i then went on the internet and found a funny clip of music for the game over screen where it says “lol you died” multiple times. Also on the game over screen if you don’t do anything it will automatically take you back to the start menu after a certain amount of frames.

Conclusion

As this is the first game i have every created, i think it has gone very well and i am extremely pleased with the finished product however there are other things i did not have the time to add, if i had more time i would of added a boss which would of been a borg cube and later on a bullet hell, the last thing i really wanted to add but did now know how and did not have time was a high score screen, so the game recorded how many enemy’s you killed and kept track of them and you could see the previous set high score. Now i have finished my game and workflow