Construct Game Development Beginners Guide — Save 50%
A guide to escalate beginners to intermediate game creators through teaching practical game creation using Scirra construct with this book and ebook.
Construct Classic is a free, DirectX 9 game creator for Windows, designed for 2D games. Construct Classic uses an event-based system for defining how the game behaves, in a visual, human-readable way - you don't need to program or script anything at all. It's intuitive for beginners, but powerful enough for advanced users to work without hindrance. You never know when you’ll need a helping hand exploring its inner workings, or harnessing its raw power to do your bidding.
In this aticle by Daven Bigelow author of Construct Game Development Beginner's Guide, we shall:
- Learn how to make a two-player platformer
- Learn how to make objects shoot projectiles and create muzzle flashes
(For more resources on Game Development, see here.)
Before we start
As there is a large amount of ground to cover in this chapter, we'll be moving quickly through steps similar to those we've done before. If it's been a while since you've used Construct, then you may find it useful to read through a chapter or two again before continuing, because certain steps assume that you are able to complete acO ons we have performed in the past.
Multiplayer: getting your friends involved
We're ready to start our next game, a multiplayer side-scrolling shooter, but before we add any shooO ng, we'll need to have the multiplayer side-scroller part finished first. So let's get to it!
Time for action – creating the game assets and title screen
The first thing we will need to do is to create our game content and create the first layout of the game, the title screen.
- First, draw up our player graphics and guns. We'll want the torso to be a separate object from the legs for easier animation. Use red dots where the legs will be attached to as markers for image point placement later on. Also include drawings for three weapons: a pistol, an uzi, and a shotgun:
- Next, we can draw up our enemies for the game. In this case, we'll use an enemy robot with a turret arm that shoots balls of plasma:
- We'll also need some scenery and ground objects for the levels:
- Finally, we'll need a graphic to tell the player to go onto the next screen when no enemies are present:
- Now we can move on to starting our game. Create a new project and set its Name to SideShooter, and enter your Creator name. Then set the window size to 800 by 600.
- Create the global variables CanGoNext, CurrentScreen, NumPlayers, P1Lives, P2Lives, GameWonLost, and RespawnY with values 0, 0, 1, 3, 3, 0, and 100 respectively.
- Following that, rename the first layout to Title and its event sheet to Title events .
- On this layout, create the layers Text, Buttons, and Background in top-to-bottom order.
- Selecting the Background layer, create a Panel object and name it Background before setting its top corner filters to Green and bottom corner filters to DarkGreen. Stretch this object to cover the whole of the layout and lock the layer.
- Now, on the Buttons layer, create a sprite and draw a box with the word Play in it.
- PosiO on this object in the center of the layout. This will be the start button for our game and should have the name btnPlay.
- Next, add the Mouse & Keyboard and XAudio2 objects into the layout and give them the global property.
- In order to finish the layout design, create a Text object on the Text layer and set its name to Title and its text to SideShooter, and position it above the btnPlay object:
- Switch over to the event sheet editor to add in a Start of layout event and use it to play a music file, Title.mp3, and loop it. This can be any title music you'd like, and it will also be played at the game's end screen.
- Next, create an event for the MouseKeyboard object with the condition Mouse is over object to check if the mouse overlaps btnPlay.
- Give this event the action Set colour filter for the btnPlay object to set the filter to Grey – 40.
- Now create an Else event to set the filter color back to White.
- In order to finish the event sheet, create an event with the condition On object clicked and select the object btnPlay.
- Add actions to this event to set the value of NumPlayers to 1 and the value of CurrentScreen to 0 before adding the final System action Next Layout:
Time for action – designing the level
Now that we have our graphics created, we can put them into our second layout and make the first playable level.
- Now we're ready to create a level layout. Create a layout and name it Level1 and its event sheet Level1 events . Then create our main game event sheet Game.
- For the layout, set its width to a multiple of the screen width (800), and check the box for Unbounded scrolling. In the event sheet of this layout, include our main event sheet Game.
- Next, give this layout the layers HUD, Foreground, FrontScenery, Objects, LevelLights, ShadowCasters, BackScenery, and Walls in top-to-bottom order. After that, set the ScrollX and ScrollY rates of the HUD and Walls layers to 0%
- On the objects layer, create a Tiled Background object named Ground and give it the smaller light gray tile image. Ensure it has the Solid attribute and stretch and place some of them to form a level design.
- Now create a Sprite object with the light green tile image and name it CrateBox . Give it the Solid attribute as well and place some around the level too. Have its collisions mode set to Bounding box.
- Next, create a Sprite named ExitLevel and fill it with a solid color. Give it a width of 32 and stretch it so that it's taller than the display height (600). Then finish the object by checking the box for Invisible on start and placing it at the end of the level:
- With the base layout complete, we can now add in three more invisible objects to handle scrolling. These are going to be Box objects with the names BackStopper, FrontStopper, and GoNextScreen.
- Have the BackStopper and FrontStopper objects colored red and marked Solid with a width of 120.
- Set the Hotspot property of the BackStopper object to Bottom-right, and the FrontStopper to Bottom-Left, before positioning them at 0,600 and 800,600 respectively.
- Next, have the GoNextScreen box colored green and a width of 32 as well as a Hotspot of Bottom-right. Position this object at 800,600:
Time for action – creating player characters and conveyor belt objects
Now we can create our player character objects and also add moving and staO c conveyor belts into our level.
- We are now ready to create our player objects. Start by inserting a Sprite and paste the standing image of the player character legs into it. Have an image point named 1 at the red spot that we drew earlier, and then place the hotspot at the bottom-middle point of the image ( num-pad 2) as shown in the following image:
- Name this sprite P1Legs, and for its Default animation, set the animation Tag to Stopped before checking the Auto Mirror checkbox in the main Appearance settings of the object.
- Next, give it the platform behavior with the settings shown as follows:
- Next, scroll down to the Angle properties box and check the Auto mirror checkbox.
- Now we are ready to add the object to a family. Scroll up to the Groups sub-group Families and click on Add to bring up the Construct: New Family screen. Note that Construct Classic comes with some default families, but will also display any family that have been used previously:
- Click on Edit Families to bring up the Construct: Families editor screen. On this screen, enter the name Legs and click on the + button:
- We can now draw the family image using the image editor that appears, shown as follows:
- After finishing the image, save it by exiting out of the image editor and check that the family is now in the list. Once finished, click on Done to return to the family selection page.
- Now select the Legs family and click on Ok:
- Now we can add the animation Walk in for our object. In this animation, set the Tag to Walking, and add the other leg sprites so they match the following image:
- Now change the settings of the animation to have an Animation speed of 5 and check the Loop checkbox.
- Next, copy the object and right-click on the layout to use the Paste Clone option, and name this clone as P2Legs. In the Platform behavior for this object, change the Control setting to Player 2 .
- Now go into the project properties and scroll to the bottom section, Controls. Click on the Add / Edit option for the Manage Controls setting at the bottom to bring up the controls box:
- Use the red X button to remove all of the controls below Jump. Then click on the Green plus button to add a new control. Select this control and click on the Pencil and paper button to change its name to Move Left.
- Click on the Key name for this control to bring up a drop-down box and set it to A.
- Now, in the Player drop-down box, select Player 2 for this control. It should match the following screenshot:
- Now continue to add controls until it matches the settings in the following screenshot before clicking on Done:
- Next, we'll create the bodies of our player objects. Create a Sprite called P1Torso and paste the normal body image of our character into it. Then position the Hotspot in the bottom-middle of the body. Give this sprite an image point 1 in the centre of its hand:
- Rename the Default animation to Normal and set its speed to 0, and check the Auto Mirror checkbox for this object as well.
- Create two more animations, Up and Down respectively. Set their frames to match the following screenshot:
- Now give the object a new family and name it Body. Then create Private Variables of names Weapon, Ammo, and GunAngle . Set the starting values to 0, 99, and 0 respectively.
- Clone this object as well to create P2Torso, and replace the sprites with the second player graphics.
- Now select P1Legs and scroll down to the Groups | Container properties to click on Add object and select P1Torso. The properties box and sprites should match the following screenshot:
- Next, put the P2Torso object into the container P2Legs using the same method.
- Now, on the Walls layer, create a Tiled Background object named FactoryWall and paste the dark wall graphic into it. Then resize it to 800 in Width by 600 in Height and set its position to 0,0 . The layout should look similar to the following screenshot:
- Switch to the FrontScenery layer and create a Tiled Background object called ConveyorMiddle, and give it the center piece of the conveyor belt images:
- Give this object the Private Variables of Direction and Speed with starting values of 0.
- Place these around the map to act as scenery, as well as using them as an object to move players with at certain points. Set the Direction variable to 1 to have the conveyor belt move right, and 2 to move left. Speed is the attribute used to determine how fast a player character is moved by the conveyor belt; a speed of 25 works well in this instance. The following screenshot shows a moving conveyor belt in the layout:
- On the same layer, create a Sprite with the name ConveyorStart and Collisions set to None. Use the starting conveyor belt image for this object and set the Hotspot to the middle-right (num-pad 6). Give this sprite the Attribute of Destroy on Startup.
- Create a second Sprite with the same setttigs called ConveyorEnd and a Hotspot in the middle-left (num-pad 4). Both sprites are shown in the following screenshot:
Time for action – creating the HUD objects
Now, we will move on to creating the Heads Up Display (HUD) objects for our game.
- We are now ready to create the HUD objects for our game. Switch to the HUD layer and create a Sprite called P1Face, and give it an image of the P1Torso head and set its Collisions mode to Bounding Box:
- Next, create a Text object called P1Info and set it up to match the following screenshot:
- Create similar objects replacing P1 with P2 for the second player. In this case, have the objects match the following layout screenshot:
- Now create a Text object for when the second player is not playing, and call it P2Join. Set its text to Press left control to join and have it matched to the following screenshot:
- Give it a Sine behavior to make it fade in and out by matching its settings to those in the following screenshot:
- Now create the final HUD item, a Sprite called NextSign, and place the next arrow image into it. Set the Collisions of this object to None:
|A guide to escalate beginners to intermediate game creators through teaching practical game creation using Scirra construct with this book and ebook.|
eBook Price: £16.99
Book Price: £27.99
(For more resources on Game Development, see here.)
Time for action – creating the main game events
Now that our objects are set up, we can go on to make their events in the Game event sheet.
- We are now ready to switch to the Event Sheet Editor to make the basics of our game. Start by adding an event sheet name Game to our project and include this from the event sheet of our level.
- Open the Game event sheet and create the empty event groups Startup, HUD, Scrolling, Enemies, Guns, Join-In, Players, Death, Sound, and LevelTransitions. These can be given descriptions relative to their group name in their group creation dialog box:
- In the Startup group, add the System condition Start of layout. Add actions for the BackStopper, FrontStopper, and GoNextScreen objects to match those as shown in the following screenshot:
- Now add actions to set the Global Variable values of GameWonLost and CurrentScreen to 0.
- Next, add actions to destroy P2Legs and make P2Face and P2Info invisible, before finally adding actions to set the Global Variable values of P1Lives and P2Lives to 3. These actions should match those shown in the following screenshot:
- Now add a sub-event with the For Each Object condition of the System object and select the ConveyorMiddle object.
- Create a System object action Create object relative to object to spawn the ConveyorStart object on layer FrontScenery at 0, ConveyorMiddle.Height / 2 from the ConveyorMiddle object.
- Do the same for the ConveyorEnd object, this time positioning it at ConveyorMiddle.Width, ConveyorMiddle.Height / 2 from the ConveyorMiddle object. The entire sub-event should now match the following screenshot:
- Now move to the HUD group and start here by creating an Always event to set the Text of P1Info to "Lives: " & global('P1Lives') & newline & "Ammo: " & P1Torso.Value('Ammo').
- Add another event to this group to check if NumPlayers is 2. If so, then set the Text of P2Info to "Lives: " & global('P2Lives') & newline & "Ammo: " & P2Torso.Value('Ammo') and add an action to make P2Join set to Invisible.
- Add an Else event just below the previous one to set the P2Join object to Visible. The three events should now look similar to the following screenshot:
- Now add an event to check if the variable CanGoNext is equal to 0 and give it an action to set the NextSign object to Invisible.
- Add an Else event just below this and give it the additional condition Every X Milliseconds from the System object, and set its value to 250 .
- Give this event a sub-event to check if NextSign is Visible, and give it an action to make it Invisible. Then add an Else event for this and have it make NextSign set to Visible, and play the sound AppPath & "GoNext.wav":
- Now move to the Scrolling event group, and add an Always event with actions to set positions of the Body family objects to the Legs family objects at image point 1. Then add another action to set the Body object Angle to Legs.Angle.
- Now add the System object action Scroll to X to scroll to X position BackStopper.X + (DisplayWidth / 2).
- Now add an event to check when Legs is outside of the layout and Invert it. Give this event a further two sub-events, checking when NumPlayers is either equal to 1 or 2.
- When NumPlayers is equal to 1, have an action to Scroll to Y of P1Torso.Y, but when it is equal to 2, have the game scroll to ((P1Torso.Y + P2Torso.Y)/ 2). The two main event branches are shown in the following screenshot:
- Add an event to check when the X of Legs is Less or equal to BackStopper.X . Give this event an action to set the X of Legs back to BackStopper.X + (Legs.Width / 2).
- Create an event for when the variable CanGoNext is equal to 1, and give it a sub-event that compares if NumPlayers is equal to 1 and a Legs object is overlapping the GoNextScreen object.
- Add a second sub-event for the main event branch and have this compare when NumPlayers is equal to 2 and both P1Legs and P2Legs overlap the GoNextScreen object.
- For both events, add actions to add 1 to CurrentScreen, and set the X positions of BackStopper, FrontStopper, and GoNextScreen to global('CurrentScreen') * DisplayWidth, (global('CurrentScreen') + 1) * DisplayWidth, and (global('CurrentScreen') + 1) * DisplayWidth respectively. The events should now look similar to the following screenshot:
- Now scroll down to the group Join-In and add an event with conditions to check when NumPlayers is equal to 1 and the control "Shoot" for player 2 is pressed for the MouseKeyboard object.
- Give this event actions to set NumPlayers to 2 and create P2Legs on the "Objects" layer at X position (global('CurrentScreen') * DisplayWidth) + 50 and Y position global('RespawnY') .
- Finish the event by adding events to make P2Face and P2Info set to Visible:
- Move to the Players group and start with an Always event to send families Legs and Body to the front of their layout with the action Send to front .
- Next, create an event for when the Legs family overlaps the ConveyorMiddle object.
- Give this event sub-events to check when the Private Variable for Direction of the conveyor object is equal to 1 and when it is equal to 2.
- Using the action Set X component of motion for the Platform behavior of the Legs object, have the first sub-event set the value to Legs[Platform]. VectorX + ConveyorMiddle.Value('Speed'), and for the second sub-event, set the value to Legs[Platform].VectorX - ConveyorMiddle. Value('Speed'):
- Now create an event for when the Legs object is overlapping the Ground object at an off set of 0, 20. Have an action for this event to set the value of RespawnY to Ground.Y - 250.
- Add events for both P1Torso and P2Torso with the condition Control is down? for the MouseKeyboard object to check when the control "Move Up" is down, or else "Move Down", or an Else event for when neither is down. Give these events acO ons to set the animation of the torso object to "Up", "Down", and "Normal" respectively. The events should match the following screenshot:
- Scroll to the event group Death and create an event for when P1Legs is outside of the layout, and give it the additional condition Trigger once while true .
- Add an action to this event to destroy P1Legs and another to play the sound AppPath & "PlayerDie.wav".
- Duplicate this event for P2Legs, but add an additional condition above the Trigger once condition to compare if NumPlayers is 2:
- Now create an event to compare when P2Legs.Count is equal to 0, and give it the Trigger once condition.
- Add a sub-event to check if P1Lives is greater than 0. Have an acrion to spawn the P1Legs object on the "Objects" layer at (global('CurrentScreen') * DisplayWidth) + 50, global('RespawnY') and a second to subtract 1 from P1Lives.
- Next, create an Else event to set GameWonLost to 1.
- Do the same for the P2Legs object and P2Lives variable. Above the Trigger once condition, add another condition to compare if NumPlayers is equal to 2. The two main events should match those shown in the following screenshot:
- Scroll down further to the group Sound and add a Start of layout event to play the music file AppPath & "Game.mp3" and another to set it to Loop.
- Add another event to check when ConveyorMiddle is on the screen and its Direction value is different than 0. Have a third condition to run the event every 500 milliseconds.
- Create an action to play the sound AppPath & "Conveyor.wav" for this event.
- Insert another event for when Player 1 presses the control "Jump" and give it an action to play the sound AppPath & "PlayerJump.wav". Have another event like this for Player 2, but also check that NumPlayers is equal to 2. All events in this group should now match the following screenshot:
- Now, in the final event group LevelTransitions, add an event for when Legs overlaps the ExitLevel object and CanGoNext is equal to 1. Have this event's action GameWonLost set to 2.
- Next, add an event to destroy the GoNextScreen object when the ExitLevel object overlaps it.
- Add a new event for when GameWonLost is equal to 1 and have it transition to the layout name "GameOver". Then create an event when GameWonLost is equal to 2 to transition to the next layout.
Time for action – creating the Game Over layout
Our players also need a screen for when they lose or win the game, so let's make this layout now.
- Now create the layout GameOver with layers Text and Background and its event sheet GameOver Events. Set this layout size to 800, 600 .
- On the Background layer, create a Panel object stretched across the entire layout called BackgroundRed and set its color Filter to WebRed.
- Next, on the Text layer, create three Text objects: GameOver, GameSummary, and AnyKeyText with the default text of Game Over, You ran out of lives., and Press any key to return to the title screen... respectively:
- Switch to the Event Sheet Editor and add a Start of layout event to play the music file AppPath & "Title.mp3", and set it to Loop.
- Add sub-events to compare when GameWonLost is equal to 1 and another for when it is equal to 2.
- In the first sub-event, add actions to set the text of GameSummary to "You ran out of lives." and the i>Filter of BackgroundRed to WebRed. For the second sub-event, set the text to "Congratulations, you've completed the game!" and set the Filter of BackgroundRed to BrightGreen.
- In order to finish the event sheet, add an event for when any key is pressed and have it transition back to the layout "Title".
What just happened?
We've covered a large amount of ground in order to create the foundation of our third game, SideShooter. In between setting our game environment up, we managed to make a two-player game where the second player can join in at anytime and players scroll by one screen at a time. Players can also get a "Game Over" from falling off the map, or be moved by conveyor belts.
Let us take a closer look at some of the things we've done.
In this game, we used Families to consolidate Torso and Legs objects of each player. This enabled us to create events for both of them by referencing their family rather than each object individually.
We used the Legs objects for containers of their respective Torso objects in order to have them spawn and be destroyed together. This also allows each Torso to know which pair of Legs to join to and allows us to spawn the second player character by only creating P2Legs.
Containers can be used in layout design to save the amount of objects being moved around. At startup, any objects in the layout that are part of a container will spawn their own counterparts automatically.
Using the built-in controls system, we were able to add our own controls for the second player to use. Construct Classic behaviors will automatically use the controls generated by default and any controls with the same name for other players. Non-default controls such as Shoot must be checked from events, as we did for spawning the object P2Legs.
We only allow the Y scrolling to be dynamically linked to the Y position of the players, but stop scrolling down when they fall off the screen.
For scrolling in the X axis, we used a mathematical formulae and the value of CurrentScreen to move by increments of the game screen width. Each time the players are able to continue and reach the end of a screen, we set the BackStopper object to the left edge of the new screen, and then the FrontStopper and GoNextScreen objects to the right edge.
Our players hold their hands out and aim up and down now, but they don't look right doing that without a gun in their hands.
We'll change this now by adding in guns, muzzle flashes, and bullets.
Time for action – adding some guns
Our players will need some tools to fight off any enemies we add later. Let us do this by adding in guns and bullets for them to use.
- In the Layout Editor, select the Objects layer and create a sprite named PistolShot and paste the pistol bullet into it. Give this sprite the Attribute of Destroy on startup and a Private Variable named Damage with value 22.
- Now set the Collisions mode to Bounding Box and add the object to a new family called Bullets.
- Add the Bullet behavior and give it settings to match the following screenshot:
- Clone this object and call it UziShot. Paste the uzi bullet image into it, set the Damage of this object to 20 instead, and have its Bullet settings match those shown in the following screenshot:
- Do the same again for the ShotgunShot object, this time having a Damage of 18 and Bullet settings to match the following screenshot:
- Now create a Sprite named Pistol and paste the pistol graphic into it. Have this object destroyed on startup and make it part of a new family Guns. Place image point 1 at the barrel of the gun.
- Set the Collisions mode to Bounding Box and check the Auto Mirror checkbox before going on to add the Private Variables of Player, WeaponNo, and CoolDown with values 0, 0, and 500 respectively. Scale the gun to fit in the hand of the player torso objects, but also scale the PistolShot object to fit in its barrel.
- Duplicate this object to make the Uzi and paste the uzi image into it. Set the WeaponNo to 1 and CoolDown to 250. Scale this in the same way the Pistol object was scaled. Remember to readjust image point 1 to the new barrel.
- Creating another duplicate, make an object called Shotgun and paste its respective image into it. Set the WeaponNo to 2 and the CoolDown to 1000 before scaling it to fit in a hand and scale the bullets it fires to the barrel. This object will also need the image point positioned at the barrel again.
- Next, add another Sprite named MuzzleFlash and paste a white circle that fades to transparent into it. Set the size of it to 128, 128, the Opacity to 50%, and Filter to a light shade of yellow. Check the Attribute checkbox of Destroy on startup and set the Collisions mode to None. Finish the object by adding the Timer behavior to it. All of the objects together should now match the following screenshot:
- Switch to the Event Sheet Editor for the Game event sheet and scroll to the Guns event group.
- Create a For Each Object event and select the Bullets object. Create two sub-events for when the Bullets family collides with the CreateBox object and the Ground object . Destroy the Bullets family object in each instance.
- Now create a For Each Object event for the Guns object and give it the Send to front action for the Guns family of objects.
- Next, add a sub-event for when the Player value of the Guns object is equal to 0. Give the sub-event three further sub-events for when the value WeaponNo is equal to 0, the P1Torso object collides with the Guns object, and the P2Torso object collides with the Guns object.
- In the first sub-event, Destroy the Guns object. Then in the second, set P1Torso value Weapon to Guns.Value('WeaponNo'), the P1Torso value Ammo to 99, and destroy the Guns object.
- In the third sub-event, replicate the events from the second for the P2Torso object:
- Next, add a sub-event to the For Each Object event again for when Guns value Player is equal to 1. Have an action to set the position of the Guns object to P1Torso at image point 1.
- Give this event sub-events for when P1Torso animations "Up", "Down", and "Normal" are playing. Use these to set the P1Torso value of GunAngle to -40, 25, and 0 respectively.
- Add another sub-event when the Angle of P1Torso is equal to 0 and have the Guns object set its Angle to P1Torso.Angle + P1Torso.Value('GunAngle').
- Insert the next sub-event for when the Angle of P1Torso is equal to 180, and have an acrion to set the Guns object Angle to P1Torso.Angle - P1Torso. Value('GunAngle'). These events should all match the following screenshot:
- Create another sub-event, this time for when player 1 holds down the control "Shoot", and give it an additional condition to run every Guns. Value('CoolDown') milliseconds.
- Add actions to spawn the object MuzzleFlash on the Objects layer at image point 1 of the Guns object and then start timer "Flash" with a length of 50 and set to Destroy when finished. Have a third action to subtract 1 from P1Torso value Ammo.
- Insert further sub-events to compare when WeaponNo of the Guns object is equal to 0, 1, or 2 and have a Repeat 5 times condition on the final sub-event as well.
- For each of these sub-events, have the Guns object spawn the PistolShot, UziShot, or ShotgunShot objects respectively on the "Objects" layer at image point 1 and play the sounds AppPath & "ShootPistol.wav", AppPath & "ShootUzi.wav", and AppPath & "ShootShotgun.wav" respectively. The events will match the following screenshot:
- Duplicate the entire event structure for when Guns value Player is equal to 1 and replace each mention of 1 with 2. Add an additional condition to check NumPlayers is equal to 2 to the main branch of this, as shown in the following screenshot:
- Now scroll to the Players event group below the event to compare Body value Ammo to being less than 0 and add an event to compare if P1Torso is equal to 99 and give it an additional Trigger once condition. Add a first sub-event to compare if the Guns value Player is equal to 1 and, if so, Destroy it.
- Add another sub-event for when P1Torso value Weapon is equal to 0 and have it create a Pistol at image point 1 of P1Torso and set its value Player to 1. Give an additional acO on to set the Ammo of P1Torso to 0.
- Create a similar sub-event, this time checking Weapon is equal to 1 and spawning an Uzi instead. Have the P1Torso value Ammo set to 30.
- Add a final sub-event for when Weapon is equal to 2, and create the Shotgun object and set the P1Torso value Ammo to 15:
- Finish this section of the chapter by repeating steps 1 through 30 for the second player object and having it also include a condition to check if NumPlayers is equal to 2 in the main event:
What just happened?
We now have guns that our players can pick up and shoot with muzzle flashes. By using the Spawn another object action for the Guns objects, we were able to create bullet projectiles for each type of Gun. The main bullets settings were controlled from the Bullet behavior of each, and once spawned, the bullets were able to keep moving on their own.
When changing weapons, we set the player Ammo value to 99 so the game knew that the player needed a new weapon.
In this article, we created the beginnings of our side-scrolling shooter game complete with multiplayer and enemies.
We took steps for making the game multiplayer using Construct Classic's built-in control system to allow a second player to play alongside the main character. Next, we learned how to add guns and bullets into our games. We added a Pistol, Uzi, and Shotgun into our game with different behaviors between them.
- Flash Game Development: Creation of a Complete Tetris Game [Article]
- Flash 10 Multiplayer Game: The Lobby and New Game Screen Implementation [Article]
- HTML5 Games Development: Using Local Storage to Store Game Data [Article]
- Unity Game Development: Welcome to the 3D world [Article]
|A guide to escalate beginners to intermediate game creators through teaching practical game creation using Scirra construct with this book and ebook.|
eBook Price: £16.99
Book Price: £27.99
About the Author :
Jayjay is a hobby game developer and software programmer. He has been creating 2D games for over eight years, across different game creation tools and programming languages. However, most of his experience lies in Construct Classic, which has been his tool of choice over the last three years.
He can often be found on the Scirra forums, where he provides advice and examples for new users seeking help.