Post news RSS Mothership Week #8

Today we get technical with Mothership and Construct 2. Learn what makes Mothership tick!

Posted by on

In October I will be joining the team in Vegas for a productivity weekend. I am going to work nonstop on Mothership with everyone and we are going to push for an alpha. Woot!

Engine - Construct 2

C2 cog logo 128x128

Construct 2 is a program you can find at It is similar to Click Team products like The Games Factory and Multimedia Fusion, which is how I got acquainted with it. Similar to Game Maker, it allows you to create games without coding knowledge. It is quite powerful and there is a large community who provide plugins and effects to the program. I have used these types of engines for quite a long time and I felt like I should make a game with Construct 2 before I move on to something a little more complicated like Unity.



If you are familiar with Construct 2 then you know what layouts are. Layouts are basically the "levels" of your game. One can be the title screen, an options menu, ect. For Mothership I only have 3 layouts. The loader (which is the log-in screen), the main menu, and the battle stage. Instead of having multiple levels for each scenario, I opted to put the entire battle sequence of the game in one level this keeps it organized and I do not have to worry about events not carrying over to other levels appropriately. Technically I could have made the loader, mainmenu, and battle all one level but the more you condense everything the more complicated it gets.


This is an early look at the login screen. Maybe we should make it have a galaxy background? As of right now, it is pretty minimal and straight to the point. Not really a bad thing but who knows?


There have been screenshots of the main menu before, but this is what the main menu looks like in the editor with all of the layers showing. Instead of putting each menu on its own layout I put them each on their own layer. Its pretty complicated when everything is showing at once. You can also see the new hexagon background (WIP) made by our graphic artist for hire Lenny.


Another in-editor look this time at the "Battle" layout. All the assets are parked outside the level. Most objects are destroyed at the start of a battle. Objects like the player's ship and turrets are spawned in as needed. A battle's scenario, visual look, type of enemies to spawn and more are all predetermined based off the selected scenario or voted sector in stream mode.

Plugin - Arrays


I am getting addicted to arrays. The more I play with them, the more I find I can do. We store tons of information about the game in the arrays. It has been unbelievably difficult to find information on using AJAX with Arrays. Most guides show you how to fetch a string or a number value from a server. This is usually good for a high-score board, common in Scirra Arcade games. We wanted to use it to fetch Javascript object information and populate an array. There was only one problem with that. Construct 2 can ONLY store a string or a number! We had to improvise and we came up with a solution. Lumberchopman added code to the server that turns his information sent into a string, I added code that fetched the string and converted it so it can be placed into an array. It was a big hurdle for us and we spent quite a while on fixing it. Whew! Now the game can read server information, load it into the proper arrays, and read data from there.



Every single projectile in the game is the same object. Each projectile has its own animation whether its a single frame or 20. This makes it easier on Construct and the coding becomes simple as well. Each turret the player is using stores its own projectile information, when firing, the projectile is at first invisible. It then immediately sets its appropriate animation/ damage/ effects, ect. Explosions are another object. These tend to be special effects or cosmetic and do not require collision checks, however, if a weapon has splash damage a 3rd non-animated sprite checks for collisions. This is due to a workaround in Constructs collision checking. During testing I noticed that the explosion sprites (typically animated) had offput collisions. I determined during the animation it would check if the explosion was overlapping the enemy during a single frame and register the hitbox for that frame but not for the rest. Using a 3rd object I can resize the explosion appropriately and get a more reliable detection. Another possible shortcut one could take - tint effects. I could have drawn the projectiles one time each with varying shades of white. Then, I could use the tint shader effect to change its color. This would free up more memory but the projectiles would lose detail and makes unique projectiles impossible (projectiles with more than one color for example). Below is an example of the laser projectile when tinted different colors and the hand drawn ones. The sizes are not exact but you can tell the one on the right has more detail but less color variety.


Event Sheets


There are so many event sheets to help keep my code organized. I have a bad habit of not commenting my coding but I can usually tell what is what depending on the sheet I am editing. This also allows me to exclude code from a layout. For example, I do not need to include the "LoaderCode" in the battle layout as nothing will be used on it.


Construct 2 is a powerful tool and while it may have its limitations I believe it is a great introduction to making your own game .It can help someone who has never coded before in bringing their dreams to life. The key to game design is to make tons of projects and basic games to learn the principles of how everything works. Mothership is a culmination of what I have learned and I want everyone to learn too. If there is an effect or feature that you see in Mothership and would like to know how it works, feel free to comment or visit us in our discord Mach V.

~ Andrew Barontini - Lead Game Developer - Mach V Gaming

Twitter - @Healstation HealWalk Discord - Mach V MachVGaming

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.