Task 4 Using a 2D Game Engine

1. Set up
First I opened up construct 2 and then created a new empty project, once I had done that I changed the window size to 480 by 640 and then after that I went and changed the layout’s width to 480 and the height to 3200. After that I created 4 new layers naming them individually. BG1 (Background 1, BG2, Tileset, Game and HUD, these are the names of the four layers I created including the current one and when I finished naming them I made sure that all of the other layers except for the bottom one was transparent so that it wouldn’t glitch in game.

2. Tiled Backgrounds
First I made sure that I was on the right layer which is BG1. Once I had done that I right clicked on the layout strip and clicked on insert new item and clicked on the tile background option and then clicked insert. After this I just clicked anywhere on the layout strip and it came up with a window that had a blank canvas but I wanted to load an image that I created so I clicked on the “load an image from a file” option and inserted the background image I created. After this to make sure everything was tidy and not out place I clicked on the view option on the left hand side at the top of construct and checked both the “snap to grid” and “show grid” option and once that was out of the way I just adjusted the size of my background image to match the layout strip.
After I inserted the main background I then repeated the steps to insert my cloud effect but of course I used my BG2 layer so that it will look transparent and not cover my main background.


3. Tileset
 First I selected the Tileset layer and then I inserted a new object onto the layout strip and then I clicked on the tilemap option and once I inserted it, it came up with a default tilemap so i inserted the tilemap I created. After everything’s been set up I clicked on the tilemap tab on the bottom right of the page and it showed me all of my tiles I then selected the pen tool and just clicked on of the tiles and I allowed me to sort of draw on my layout strip with the tile I selected. I also edited some of the collision mask on the tiles by double clicking on it and then dragging the points around.

4. Vertical Scroll Parallax
First I locked the three layers which were BG1 and 2 and the Tileset layer, after that I selected the game layer so that I could add the sprite, and just like what I did with the previous layers I right clicked on the layout and clicked on insert new object after the window popped up I  clicked on the sprite option and when I clicked insert I then clicked on the layout strip and it came up with a window with an empty square in the middle which will be the sprite I will use for the parallax.

Because it won’t be visible anyway it doesn’t really matter what it looks like but I did change size of it to 32 by 32 so that it matches the squares on the layout grid ad then I added an origin point and so that it’s dead on the centre I changed both the X and Y to 0 from 16 I then changed the angle to 270 so that it would face upwards I also changed the position to 224 by 2880 after this I added two behaviours the scroll to behaviour and the bullet behaviour so that it would move and changed the speed to 30 which is the same speed as mekka hornet. I then changed the parallax of BG1 to 50,50 and BG 2 to 75,75 and this just makes the other one scroll a bit faster than the other which adds a pretty cool effect to it.

5. Character and Movements
First I went to the game layer and then I inserted a new sprite and instead of inserting an image I went to the animation frames window and imported my player asset through a sprite strip which then came up with a window showing me the number of horizontal cells and vertical cells but it came up with 4 for the horizontal cells and 1 for the vertical cells so I divided it appropriately and changed the horizontal cells to 2 because I only had 2 a 2 frame animation, after this I wanted to add more animations so I added a new animation on the right hand side window saying animations and named it Bank l for Bank left and then I just repeated what I did for the default animation and just repeated the process for the Bank right animation after this I right clicked on of the animation bars on the right hand side on the animations window and clicked on preview but there was no animation yet so I clicked off the preview window and changed the loop settings to yes which was on the left hand side.

When I clicked off the window the origin of the player was in the centre and the widget was indicating that it was facing a different way from what I wanted it to so I went back to the sprite and rotated every sprite 90 degrees clockwise after this I changed its angle to 270 so that it’s facing up the same way the parallax sprite is and to add to it I added the 8 direction movement and changed he set angle to the no option so that it doesn’t face left and right which I only want it to bank left and right and from the 8 direction movement I changed it to 4 so it’s just left, right, up and down.

Next I added custom movement behaviour so that I could set the vertical speed so that it moves at the same speed the scroll object is moving and to do this I had to tie the both of them together which happens every frame of the game. To do this I added my first even which is located in the event sheet near the layout bar at the top. When the window came up for the event I clicked on the system option and clicked on the every tick and tick just basically means frames. After that I clicked on add action which is right beside the event I just created and once the window came up I clicked on the player sprite icon and clicked on set speed option under the “Custom Movement: Velocity” section I then selected the Vertical speed from the “Which” drop down menu and set the speed to the scroll object and it’s bullet speed. After that I also made sure to set the angle motion the same so that it’s heading on the same direction so once again I added a new player action which was found under the section “Custom Movement: Angle of Motion” and put the speed to Scroll.Bullet.AngleOfMotion, so now the player sprite will move at the same speed as the scroll object and it won’t be left behind by the layout anymore. 

Now this will allow us to adjust the scroll speed and you can do this by clicking on the scroll object and then change the bullet speed and I can use this as a sort of a game mechanic like if the level starts to speed up or when the boss battle appears where it stops to do this I will have to change the speed to nothing when doing the boss battle later on. 

Next is setting the limit to the player movement and what I had to do was to compare where the player is from the scroll object meaning that I’ll have to work on the X and Y axis, Y is up and down and  X is left and right. So I first went to the event sheet and added a new player event and then went to the Size and position section and clicked on the Compare Y option and a window came up and I changed the Comparison drop down menu to Greater or equal and then put the Y co-ordinate as Scroll.Y+320 which is half of the screen but so that it doesn’t pop off of the screen I took away 16 from the 320 so now my code looks like this Scroll.Y+304(Pixels) so no if the Y co-ordinate of the player is greater or equal to the scroll object’s so now what I need to do is add an player action and then set the Y co-ordinates of the player to the same as what I set it as before which was the scroll.Y+304 and with this it won’t allow the player sprite to go off the screen downwards for it to no go off upwards I just repeated the process but this time I clicked on the less than or equal to option and put a minus sign instead of a plus. 

For it to not go off the left or right side of the screen I added two new player events along with the player actions, so first event I selected the compare X then chose the less than or equal to option and put 16 on the X co-ordinate and on the player action I clicked on the set X option and set it to 16 as well. For the other side I just repeated the process but this time I chose greater than or equal to and set the X co-ordinate’s to 364.

6. Player Animation and Particle Effects
First step was that I inserted a new object which was the keyboard I then went to the event sheet and added a keyboard event and selected the key is down option and selected the right arrow key I then added a player action and then set the animation to play “Bank R” so now whenever the right arrow key is pressed down the player animation will do the bank right animation then I added an additional keyboard event but this time I selected when key is pressed down option and then the right arrow key, this will now make the player go back to default animation when I let go of the right arrow key  and you just repeat the process for the bank left animation.

As an additional feature to the player movement I added a particle effect where if you press the up arrow key flames will shoot out from the back of the player. So I started by inserting a particle object outside of the layout and then I added my own particle which I created. To put it all together I started off by changing the rate to 2 and the type to one shot and changed the spray cone to 1 so that it would come out in a straight line. Now going down to the initial particle properties section I changed the growth rate to -64.

Next thing I did was create an image point which I then applied to the other animations so that later on I’ll be able to use as reference when I need to link the burn particle to the player. Now to link it to the player I created a new keyboard event with the up key pressed down with a system action and programmed it to create an object which is the engine part on layer 3 and then created another system action only this time instead of having Player.ImagePointX(1) I just changed the number to 2.

7. Player Firing Events 1
Fist I created a new event group for the player fire then I created a new object which will be the player bullet I then set the angle to 270 and after that I added a new keyboard event so that when the spacebar key is pressed the player bullet will spawn or create an object from the player and I did this by adding a system action. Currently I would have to keep on pressing on the spacebar to get rapid fire but I can just programme it later on so that if you hold down on the spacebar it will keep firing. Another thing I have to do is to programme the bullets so that when they leave the screen it will get destroyed because if the bullets keep going even though it’s out of the screen it will create collision masks that are active as they scroll even further.  So to this I had to create a playerbullet event and clicked on the is on-screen option but after I clicked off it I then right clicked on it and click invert.  So now I just added a player bullet action and chose the destroy option near the bottom.


8. Player Firing Events 2
First I created two instance variables on the player one being cooldown and the other being firerate I then changed the condition for the first keyboard event I created under the player fire event group so instead of when the spacebar is just pressed I changed it to when the spacebar is down I then created a sub-event under the even I was just on and I chose the compare instance variable option and put equal to -1 and then added a player event and set value to 0 for the cooldown. Next I added a new player event and compare instance variable to greater or equal to and left it like that and then I added player action to add dot to cooldown.  

After this I added another player variable compare event and this time put the cooldown to greater or equal to Self.FireRate. For the action I set the cooldown value to -1 and then I changed the fire rate to 0.5. For my character to shoot out two bullets I created more image points and for the bullets to come out from the two points I just changed the create object  PlayerBullet on layer 3 at (Player.X, Player.Y) to Player.ImagePointX(3) and Player.ImagePointY(3) for the Y, but this is only for one bullet so to create another one I just copied and pasted it and instead of 3 being in the brackets I changed it to 4. 

To make my bullets act more like a machine gun I added a bullet action in set angle of motion and set it to Self.Bullet.Angleof Motion+random(-1,1), I did all of these under the first event I have on the Player Fire event group.


9. Weapon and Power Up
So to start I added a new instance variable on the player sprite so I added a new player condition under the first event I created in the Player Fire event group and chose the Compare instance variable option and set the weaponpower instance variable to equal to 0. After this I copied pasted it and changed the weaponpower instance variable to equal 1 and then I made a duplicate of the bullet animations and then I programmed the duplicates to produce and spread more bullets with one being Self.Bullet.AngleOfMotion+random(-1,1)-3 and the other with +3

After this I duplicated the duplicate but this time changed the instance variable of the weaponpower equal to 2 and then I duplicated the bullet animations again and increased the degrees by three so it looks like this Self.Bullet.AngleOfMotion+random(-1,1)-6  and the other being +6 and then repeat the process again with the last ones being -12 and +12and then I started adding firerates for each of the duplicates from 0.2 to 0.05.



10. Hit Points Bar and HUD
First step was to create another instance variable for the player and set the initial value to 100 and that will be how much HP or Hit Points the player has. After this I went onto the HUD layer and set the parallax to 0,0 then I inserted a new sprite which will be the health bar and then I set its size to 200,16. I created a new event group for this so that my even sheet would look tidier. I created a new instance variable for the player for the maxHP with the initial value of 100. After this I added my firs system event under the player hit points group clicked on the every tick option and then added a health bar action and put it as (200/Player.maxHP)*Player.HP  and then I quick assigned the origin point of the health bar to the left I then added a colour effect to the health bar so that when it reaches certain points it will change from green to red.

The next thing I did was create a new health bar action on set effect parameter and set the value as 100-((100/Player.maxHP)*Player.HP) and this is for when it changes to red and for the green I did the same but put 1 for the parameter index and for the value I used the same code but without the minus so it looks like this (100/Player.maxHP)*Player.HP  and for the last part I just added a new system event  so that on start of layout I set the value of the players HP to maxHP.


11. Enemy 1 Spawn and Movement
First I went to the game layer then I inserted a new sprite which was my enemy and I did this by doing the same process as I did when I inserted in my player. Then I changed its speed to 15 and selected yes on the loop option, after this I changed its orientation point and put the angle to 90 so that I’s facing the player, I then inserted a new sprite but not an animation, it was just to serve as a sort of spawner for Bug 1 and to do this I just cropped out the other half of the strip and recoloured the background. 

Next I disabled the collision map of the spawner and turned it invisible and then gave the Bug 1 enemy a destroy outside of layout behaviour and then after I created a new group for this coding I added a sub event which was for the bug 1 spawner and then I selected the compare Y option then I chose the greater or equal to option and set the Y co-ordinate to Scroll.Y-200 and then I created a create and object action which I then selected the Bug 1 enemy and put the X as  Bug1spawn.X and the Y as Bug1spawn1.Y  after this I added a system condition to the current event and selected on the for each option and selected the bug1spawner.

Then I added an event where the bug spawner would be destroyed and then changed the Scroll.Y to -338. After this I added a bullet behaviour on the bug 1 enemy and set its speed 500 and it’s acceleration to -500 I then made an event to compare the speed of the bug 1 enemy to less than 20 and then put it’s angle of motion towards the player and then set a bullet acceleration for the bug 1 enemy, I then put -180 at the end of the angle of motion action.   After this I added a keyboard event where is you press Esc it would restart the layout.  Then I added a Boolean Instance variable to the bug 1 enemy, after this I added a bug 1 enemy action and set the Boolean to True I then added a new bug 1 enemy event and inverted the is on-screen condition and then added another condition so that the Is on Boolean instance variable set is on the HasSpawned instance variable and then I added a destroy enemy action. 





12. Enemy Hit Points
First I added an instance variable for the bug 1 enemy HP then I added an enemy event so that when it’s on collision with the playerbullet it will subtract the amount of health I set it to and then another action so that when the player bullet hits the bug 1 enemy the player bullet would get destroyed. After tis I added an event where if their HP is equal or less than 0 they would get destroyed and then to indicate that the player is damaging the enemy I added a brightness effect to the enemy so that it would flash if the player is dealing some damage to them and for this to actually work I added an enemy action where I set the effects parameter value to 175 then I added a system action to Wait for 0.05 then repeated the effects parameter process but this time set the value to 100.

13. Enemy Fire
First I inserted a bullet object then I imported in the bullet that I made and added a bullet a bullet behaviour to it along with giving the bug 1 enemy another instance variable which to False Boolean and this all just a repeat of the players instance variable system. After that I added a Line of Sight behaviour to the bug 1 enemy and gave it 1 ammo, then I changed its Line of Sight range to 500 and the Cone of View to 2 degrees. Then I added 3 sub-events first one was I set their Line of Sight to the player and then set the shoot Boolean to true then added a new system condition and set it to For Each bug 1 enemy, 

Then I added a bug 1 enemy sub-event on the sub-event and compared it’s CoolDown Instance Variable equal to -1 and added a system action to create object which is the enemy bullet  and put it on layer three with the X set to Bug1enemy.X and Y to Bug1enemy.Y. After that I added an enemy bullet action and set its angle of motion to the bug 1 enemy and then I added a bug 1 enemy action and set its cooldown value to 0 and I added another bug 1 enemy condition and compare its ammo instance variable to Greater than 0. I then reused some codes from the player firing system and then I changed the bug 1 enemy’s FireRate to 0.2 then I added a bug enemy action to subtract from ammo.


14. Enemy Destroyed FX
First I added a particles sprite for the explosion effects, and once I had inserted my particle effects I changed its size to 32 by 32 and its angle to 270 and its type to one-shot and increased its cone to 360. Then I added a system action on the event I created where the health reaches 0 so that when it does reach 0 it would create the explosion effect.  After, I changed the grow rate to -32 and its timeout to 0.3 then I imported my own sound by inserting an audio sprite so I added an audio action on the same event as the explosion effects and I conditioned it to play the sound.


15. Player Gun Audio and Enemy Fire Damage     
 First I went on my Player Fire event group and then I added two blank sub-event then for the first event I set it on keyboard and the on key pressed to spacebar, then I added an audio action and used the sounds I created an imported into construct which will play every time the spacebar is pressed and I also tagged it for future uses. For the second event I set it to keyboard on key released and added an audio action so that it would stop whenever the spacebar is released.

After I imported the sounds for the player fire I added an instance variable on the enemy bullet so that when it hits the player it would deal damage.  So the first thing I did was add the instance variable then set the initial value to 10 meaning that it will subtract 10 from the players hit point value which is 100 once I’ve set that up I added a player ­sub-event and put chose the on collision with another object then I added a player action and then clicked on the subtract from and set the instance variable to the players HP and set the value to EnemyBullet.Damage and then added an enemy action bullet so that when it hits the player it destroys. I added another sub-event so that if the player collides with an enemy it will also deal damage so first I added an instance variable on the enemy bug 1 and then I just did the same process I did with the enemy bullet . I then added another sub-event to compare the players HP to less than or equal to 0 I added a player action so that when this happens the player will get destroyed.  

Next I repeated the brightness effect of the bug1 enemy onto the player so I just copied the system that I already made and pasted it into the event where when the enemies collide with the player it subtracts from the players HP and also the on the event where the enemy bullet subtracts from the players HP and replaced the objects to player.

16. Adjusting Collision Masks
I just double clicked on the player and adjusted its collision mask so that objects will only collide with the parts that are within that objects collision mask. I repeated these steps to also adjust the collision masks on the bug1 enemy, player bullet and the enemy bullet.





17. Player Destroyed FX
First I inserted another player sprit but cropped out the other one and then I made sure that the origin point was in the middle then rotate it and then put its angle to 270 like all the others.  After this I added two behaviours to it, one was the bullet behaviour and the other was the destroy out of layout behaviour  once the bullet behaviour was in place I changed its speed  to -50. In the player hit points group event I added a system action on the event where if the player hits 0 HP it’ll get destroyed and the new action is so that the player will create an object whenever it gets destroyed so I set the X to Player.X and the Y to Player.Y on layer 3.

I then changed the set angle on the player death sprite to no and added a new system condition on every tick and added a player death action on set size and set it’s width to Self.Width-dt*20 and the same for the height but just changed the width with height then added another action so that it will rotate clockwise and set that to dt*200. I then added another condition to compare the player death height to less than or equal I then added a player death action and set it to destroy. For the next bit I added another player death condition and set it to is on-screen and put the action so that it would systematically create an object which is the enginepart sprite on layer 3, PlayerDeath.X and PlayerDeath.Y the on the same event I added an enginepart action on set angle to PlayerDeath.Angle-180, then I added an effect on the event where the if the player height is less than or equal to 0 and the for this effect I just repeated the same process as I did for the first one and for a final touch I added my own sound which I imported using the same method as I did for the bullets but not looping.

18. Maggot Launcher Part 1
For the first part of the maggot launcher series I inserted in the maggot launcher and put its image point where I want the maggot to come out from then after I inserted in the spawn sprite along with the maggots which I used the same process that I used for player and then set their collision mask right then it’s loop to yes, the speed to 15 and the ping-pong to yes.  Then I added another group and for the first event I just reused the first two event from the bug 1 enemy group and replaced the objects  while deleting some of the actions except for the destroy and the create object. After I added the bulge effect on the launcher I changed its scale so that it would look like its pulsing then I added a sine and a destroy outside layout behaviour to the launcher then I added an every tick system event and set the bulge effect parameter’s index to 1 and the value to abs(self.sine.value) and changed its movement to value only.  


19. Maggot Launcher Part 2 
For this part I added a bullet behaviour to the maggots and lower its speed and the set angle to yes after this I added 4 instance variables to the launcher with one being a Boolean and the other three being just the default number then I reused some events from the bug 1 enemy group from the line of sight up to the second to the last event and then I just repeated the process I did for the first ones which was just replacing the objects then I removed one and added a set angle of motion action for the maggot.  After this I added another condition under the fourth event in the group to compare the maggot launchers Y then set the ammo to 10 and the fire rate to 0.3.

Then I added a maggot launcher action to set the fire rate value to random with a minimum and a maximum then a maggot action with a set bullet acceleration and another with a compare distance travelled to random with a minimum and a maximum. The from
the bug 1 enemy group I copied the angle information from the even with the bullet speed then i pasted it onto the the even with the distance travelled and changed the bug 1 enemy from the angle info to the maggot instead then after, I added an acceleration action for the maggot. 



20. Maggot launcher Part 3
Next I added 2 instance variables for the maggot and one boolean instance variable for the maggot launcher then i added a new event so that when the maggot collides with the player bullet it will subtract 1 from its HP then i added a compare instance variable event for the maggot so that when it's hp is equal or less than zero, it would also get destroyed along with an added particle system action. After I set that up I then added another action to set the particle's size to match the maggot, 

Then I repeated the process for the maggot launcher with the player bullet being destroyed once it has collided with the launcher then I added an audio action along with the particle action so that it would create the particle object when it's destroyed and I also repeated the process of making it flash when it's hit just like the player and the bug 1 enemy. 

After this on the player HP group I added an event and actions where if the player collides with the maggots it would subtract from it's health with basically the same setting as if the maggots were bug 1 enemy bullets. Then i added a timer behaviour for the maggot so that when it's reached it's time limit it would automatically destroy itself then I put this into effect by adding an action on the event where they are spawned. Next I added a on timer maggot event then set the maggots hp value to zero for the action. For the next event i used the launcher and compared its Y then a destroy action then i added a destroy outside layout for the maggot sprite. 

21. Bug 2 Enemy Part 1
First I inserted the spawner sprite in and change its angle and orientation like the others then I inserted in the actual enemy sprite which I inserted the way I did with the player which I also repeated the animation process after that I also imported in the turret and added some image points where the bullets will come our of. After I had set that up I then set up the bug 2 enemy group then for the first event I compared the bug 2 spawner's Y to scroll.y+100 and then I added a for each condition on the same event with the bug 2 spawner as the object and the for the action I added a create object action and the object is the bug 2 enemy and set both the X and the Y to bug 2 spawner.
I then added a bug 2 spawner action to destroy.

 Then I clicked on the bug 2 enemy and chose the turret for the container after this I added a turret action and set its position to the bug 2 enemy's image point 1 then I set the bug 2 spawner to invisible and disabled its collisions. Then I added 2 instance variables to the bug 2 enemy one being a boolean and then still on the same event for an action i set it's scale to zero and i repeated the process for the turret. Then for the bug 2 enemy I set the boolean to true then the for the next event I set the bug 2 enemy's scale in to true then I added two bug 2 enemy action and for one I set its scale to Self.scale and the other I chose add to and then dt the i set scale for another which was the turret and put it to bug2enemy.scale. 

For the next event I put it as bug 2 enemy and then compare instance variable and set its scale greater or equal to 1 then for the action I set the bug 2 enemy's boolean scale in to false.


22. Bug 2 Enemy Part 2 
First step on making them move I added a bullet behaviour to the bug 2 enemy along with two other sine behaviours then on the spawn event I set an acceleration for the bug 2 enemy to 40 and a set speed of 20 then I added in a new bug 2 enemy event with the bullet distance travelled condition with a random value and then I added an action for the bug 2 enemy's bullet speed then I deactivated both of the sine functions. After this I created a new instance variable for the bug 2 enemy then i add another condition to the previous one I just did and put set it up so that the movementmode is equal to zero then on the same event as an action i set it up so that the movementmode's value is on 1. For the next action I set the sine to active for both the sine 1 and 2 for the bug 2 enemy but on separate and individual actions.

For the next bug 2 enemy action I put on the sinemagnitude option and gave it a random parameter which i then repeated the process for the other sine, then on the event sheet I set one of the sines to horizontal and the other to vertical then changed their periods both different from each other then added another bug 2 enemy bullet acceleration action then i add a system event along with an action to stick the turret to the bug 2 enemy's image point, after this I then created a turret behaviour for the turret then i changed some of it's functions like the range and rate of fire, Then once i've set that up i went back to the spawn event and added an action so that the turret would target the player.

Then on a new even set it up so that when the player is in range it would shoot and for the action to create an object which would be the enemy bullet then I copied and pasted it and just changed the parameters. After it I added an enemy bullet angle of motion action and just repeated it for the other bullet action that i first created on the even where if the player is in range it would shoot.






23. Bug 2 Enemy Part 3 
The first thing I did was set up the turrets sine system like editing it's movements and whether it's enabled or disabled from when it spawns. Next on the event where the turret is on can shoot I added another condition and put the can shoot value to greater than 30, then to changed their speed I played around with their period and random period value. Next I added 2 new instance variable on the bug 2 enemy which were it's ammo and it's HP then I added an event where if it collides with the player bullet it would subtract from it's hp and the player bullet would also be destroyed I then added another event to go along with it where if it's HP is less than or equal to 0 it would get destroyed along with the turret attached to it and then i recycled the sound and particle action from the bug 1 enemy and just changed the X and the Y.

Then to get it to flash when it's been hit by the player bullet I first added a brightness effect to it and then recycled some actions again from the bug 1 enemy and just replaced the objects to the bug 2 enemy which is a quicker way of doing things, just recycle already used events and actions. Next I added a couple more events and for the first event i coded it so that when it's ammo is less than or equal to 0 the movement mode instance variable would change it's value to 2 then for the second one I coded it so that when movement mode is equal to 2 both of it's sine will be inactive then I set its bullet acceleration speed to 40. Next I added another condition in the event where the turret is set to can shoot so that the bug 2 enemy's ammo is greater than 0.  Then lastly I added new event so that when it's off screen it would wait a second and then it would destroy itself along with the turret.



24. Boss Bug Part 1 

Like the other the first thing I did was to insert in the boss sprite first and set it's position so that it faces the player then I imported in the boss pods as a sprite strip and rotated them the way they should be then as an animation they should open but to close them I duplicated the first animation and just swapped the order of the sprites then I copied and pasted two more of the sprites and placed them on the boss and then so that they actually stay on the boss I added a pin behaviour to them like I did with the turrets then after this I inserted a new turret sprite which i also added a the needed image points along with the pin behaviour like the boss pods and the bug 2 enemy turrets, even though I already have a turret object I imported this one as a seperate just for the boss because if i used the same one as I did with the bug 2 enemy then there would be conflict in the game and between the animations. 
Next this I imported is a sprite strip of the missiles that would be shot out of the boss pods then I set it to loop with a seed of 25 then I changed it's position so that it's the right way.





25. Boss Bug Part 2
First I created a new group event for the boss bug and then I started to pin the sprites to the boss which were the boss pods and the turrets as soon as the boss is created and then I set the boss pods animation to as a tag "open" from the beginning and another action so that it stops. Next I set a bullet behaviour for the boss so that it can move towards the player and for other purposes. Then as a new even I compared the boss bugs Y to scroll.Y-538 and then i set the scroll speed to 0 then made sure that when the boss is create the boss created it's bullet speed is disabled then as an addition a boss action saying that the bullet would be enabled. Then I copied and pasted the event i was just on but changed it's Y to -150 instead and deleted it's 2 actions and replaced them with a new action which was a bullet acceleration for the boss bug.

 Then after that I added a few instance variables needed to the boss which is very similar to the bug 2 enemy but with 3 or 2 new ones. Next for the event I was just on i added another condition where the mode instance variable is equal to 0 then for the action I the mode to 1. For the next event I coded it so that mode is equal to 1 and set the animation to open but with another one that tells it to start the animation from the current frame then I added a timer behaviour n the boss which I then put a new action the tells the timer to start tagged "shoot" for 1 second and once again changed it's mode but this time to 2.
For the next event I coded it so that when the boss's on timer tagged "shoot" then set the canshoot value to true and set the boss pod's collision mask to enabled.



26. Boss Bug Part 3 
For this part I added a bullet behaviour to the missile sprite then I added a new event which I coded so the boss's canshoot boolean is set to true then as a sub-event I put the boss's cooldown to equal to -1 and for the action I set the cooldown value to 0. Then I created another sub-event on the sub-event and for that I put it to a for each system and set to the boss pod and then I added another system condition and set it to repeat 20 times and for the action I set it so that it creates the object which is the missiles and set it's X to bosspod.X+random(-32, 32) and just repeated this for the Y co-ordinates and then I set it's bullet angle of motion to loopindex8(360/20). 

For the next event I set the boss's cooldown to equal or greater than 0 and for the action I coded it so that it adds dt to the cooldown. Then for next event I set the cooldown to greater or equal to the firerate then I set the cooldown to -1 after this I went back to the first sub-event and added an action where it would subtract 1 from the missileammo. For the next event I set the boss's missileammo to less than or equal to 0 then then the boss's canshoot would be false .

Next I created an event for the missiles range or bullet distance travelled, so for the first condition I set it to greater than 100 and for the second one I set to to less than 120 then I added another condition which was when the is missile is on screen but then i inverted it meaning its now off screen it would get destroyed and for the first condition I put an action where I set it's angle to self.angle and then for the second action I set it to rotate 5 degrees towards the position of the player
 


27. Boss Bug Part 4
I started by adding a new action on the event where it says the missileammo is equal to 0 I set the boss bug missileammo value to 3 and then another one where I set the bosspod animation to close on the same event and then another one saying to start the animation from the current frame then I set the mode to 3. Next I added a sign behaviour to the boss which I set as inactive at first but on the same event I set the boss's sine to active with a period and a random period of 8. Then I added a new system action to wait for 3 seconds.

After this I added a turret behaviour to the boss turret with a range of 500 and 0.3 firerate then for a new event I set the boss's mode to equal to 3 and then I set the boss turret to enabled as an action and for it to acquire target which I set it to the player after this I set a reload time for 3 seconds on the boss as an action with then I set the boss mode to 4. For a new even I set the boss turret to on shoot and 2 actions for it to create the enemy bullet object that I used for the other enemies an action for each of the boss turret's image points and then for the third action I set the bullet's angle of motion to bossturret.angle degrees which I made two so that the other action will have one too then the next thing I did was set the boss turrets fire rate to boss.HP*0.2. Then for a new event I set it to the boss and on timer tagged "reload" I set the turret to disabled with another action of boss's sine which I set to inactive then I set the boss's mode back to 0. For the event with the mode 3 I added a wait action of 2 seconds and changed the reload time to 5 seconds.


28. Boss Bug Part 5 
First I added a HP instance variable and brightness effect for the boss pod then for the event I set it so that when the boss pod collides with the player bullet the action is that it will subtract from it's HP with and for the brightness effect I just repeated the same process as the other enemies i used it for.
Then for the second event after it I set it so that when the boss pod's HP is less than or equal to 0 then it would get destroyed but it would also subtract from boss's HP and then I added the particle effects like i did with the other enemies but with a different size. Then for another event I coded it so that when the boss's HP is less than or equal to 0 it would get destroyed along with the turrets then as a sub-event I put in a repeat system and set it to 20 and that it would create the blood particles like the other enemies.


29. Boss Bug Sound FX, Player Damage & Change Layout 
So the first thing I did was i copied the sound that I used for one of the enemies and pasted it into the event where the bosspod gets destroyed then I set made a damage instance variable for the boss and the missiles then I went back to the player group event and copied and pasted the event and actions where the player is colliding with the maggots and I just changed the maggots to the missiles which I then repeated and changed the objects to the boss bug and deleting one action. Next I added timer behaviour for the player and then for the event where the boss is destroyed I start the players timer with a 4 second duration tagged "end of level" and then for a new event I put the player on timer tagged "end of level". After this I went on the layout and added a new layout but without an event and then I added a system action to go to the new layout I just created.





30. Power Ups & Score
First I created a new group event then for the score I had to create a global variable. So for the first event I put it as on start of layout I set the global variable score to 0 then I went back to the bug 1 enemy and on the event where it's destroyed I added action so that it adds 10 to the global variable value or the score and I just repeated this for the other enemies but with different values. For the score I inserted a new text object and just played around with it till i got the look that I thought suited my game art.

Next is the power up and for this I first started by inserting the spawner for both the shield and the gun power up then I inserted the sprite strip versions of the two and adjusted their positions and then in the event sheets I just repeated the process I used for my other enemies. Next thing I did was to finally set up the collision events so that when the player collides with the shield power up it will reset the players HP to it's Max HP then for the gun power up it will add the value of 1 to it's weaponpower and of course the power ups will get destroyed as soon as they collide with player.

After, I went back to the player fire group event and added one more event so then I set the players weaponpower to greater or equal to 2 and then for the action I set it to 2.





31. Intro Screen 
For the intro screen I added an event sheet then I inserted a new tiled background object and then I imported in the title screen that i already made and just resized it to fill the screen then on the intro event sheet I added a keyboard event and on any key pressed then go to layout and tagged "level 1" then I went back to the game event sheet and then I imported in the background music that I created. After this I added another event on system on the start of layout and for the action it would play the track and I put it on loop and then I coded it so that when the player dies it would stop. For the folder I changed the first layout to the intro.



Completed and Recorded