In the second post we checked the basics of the enemies in Space Chain, a starter kit that you can download here. You can also get it and play it at the Windows Store and check the Windows Phone version too.
And you can play it here too:
In Space Chain the player should destroy the falling enemies before they touch Earth. The control input relies heavily on Construct’s capabilities and allows the player destroy the enemies using their mouse or the touch screen when available.
To obtain more points the player could destroy enemies of the same type and create chains. That is also the origin of the game’s title.
The purpose of this Starter Kit was to provide a base showcasing the basic controls for sprites in Construct 2 and elements commonly used in games like a score, a pause button, game over conditions and global variables.
This starter kit was also a good example on how to take a Construct 2 game and publish it in the Windows Store.
In future posts we will study more complex examples and how to port these games to Windows Phone.
In the previous posts we have seen the main mechanics of Space Chain, but many small details that are needed for the entire game to work where not covered. This post will focus on the small details and wrapping our game up.
We will start with the Global Variables, that can be seen in the following image:
MonsterSpeed: Determines the speed for the monster to fall from the top of the screen. Like all the speed attributes of Construct 2 behaviors, it is given in pixels per second.
Score: It stores the score obtained by the player. I will augment when the player touches/clicks one of the monsters, and will receive a bonus if the player is creating a sequence of destroyed monsters of the same type.
LastDestroyed: You can see in the previous post how this variable is used to store the type of the last destroyed monster, this is useful to compare with any new monster being destroyed and determine if a chain is being created.
SpawnSpeed: This variable is used to determine how many seconds it takes to create a new enemy. If you change it the enemies will appear faster in the screen.
Lives: This variable saves the value of the initial lives given to the player at the start of the game.
ChainNumber: This one is used to keep track of how many monsters of the same type have been destroyed consecutively.
TypeMonster: Is used to determine which kind of monster will be created next. The random function sets the value of the variable to have different monsters every time the game is played.
Pause: Let us know if the player has paused the game or not.
isPlaying: It will be 1 if the player is currently playing or 0 is the game over conditions has been reached.
Now we will check the events not covered in the previous posts. The first one is executed every time the game starts:
This event sets at the beginning of the game the value of the important game variables and hides the game over text.
The following event is executed in every iteration of the game cycle to set the right value of the score and bonus labels. It also contains a sub event that decreases the value of the SpawnSpeed variable which makes monsters appear faster in the screen. This is particularly useful because at first the monster will be spawned slowly and the the difficulty is increased.
The two following events are used when the game is over (isPlaying=0) And they reset the values of important global variables if the player presses the space bar or touches the Game Over label.
The following event is checked every tick of the system and is used to find out if the game over condition is reached, then it sets the appropriate variables and displays the Game Over Label:
As you may see Space Chain is a simple game that includes many of the basics of Construct 2. You should download it and make it your own. In future starter kits, and updates of Space Chain, we will improve the menu system and add more interesting mechanics.
One of the many changes you can implement is to alter the angle used by every monster in their falling movements. You can make them use diagonals starting at random points at the top of the screen and aiming to random points at the bottom. That way the player could have an increased challenge and will not know so easily the trajectory.
Another change could be the inclusion of Bosses, every X seconds or every X destroyed monsters you could add a new kind of monster that occupies a big portion of the screen.
In the end the project is yours and I will be glad to see how you are using it.