Basic Platformer Game Engine for Construct 2/3: Customizing Baddies

Both the essentials and the full version
of the Platformer Game Engine includes some basic enemies you can use to add
challenge to your levels. To make a robust game you’re likely going to want
to add some additional enemy variants with different attributes. The most easy
way to start adding more enemy variety is to simply change specific aspects of
any particular instance of the basic enemies. As an example I’ll make this
first basic enemy much larger and then go to its platform behavior and change
its maximum speed to slow it down. When I run the level you’ll see the newly sized
enemies and when the player bounces off of or shoots the mini flying enemy
the regular basic enemy that is spawned matches whatever size we’ve made the
flying enemy in the layout editor. The variable “respawn duration” in the flying
enemies is used to set the respawn time of the basic enemy it spawns once it’s
been hit. If you set that to a negative number the flying enemy will never
respawn after the resulting basic enemy is destroyed. You can switch the
sine-wave movement pattern of any flying enemy from vertical to horizontal. The
game engine will automatically make it change the way it’s facing when it turns.
Playing with these few aspects of the enemies can give you a large amount of
variety in the game, but variants that look and behave more differently will be
our next step in making a fully-realized original game. While the basic enemies
use standard Construct sprites it can be very helpful to animate your enemies in
Spriter, and then export the finished animations as full-frame images which
you can then import back into the game project. We’ve provided the Spriter
project for the basic enemies which you can use to easily create new variations…
but first back in construct we need to create a clone of the enemy we want to
create a variant of, then give it a new name. Now in Spiter, let’s load up the SC
ml file in the folder called “basic enemy”. Now start editing the body part images
in your graphic editor of choice. clicking the refresh button in Spriter
after you’ve resaved the images. Continue with this process until you are happy
with your new enemy. Be sure that every animation is fully
changed to the new look. Now we’re going to find the animation that takes up the
most space and set a custom trimming rectangle that will accommodate all of
the animations without turning off any of the art around the edges. Too large is
better than too small because you can crop the images frame by frame later in
Construct. Now choose file/export animation to PNG or Gif, then turn on
batch export and expand the dialogue box to see the list of entities and names.
Uncheck all the entities you don’t need to export and make sure it’s set to
“separate numbered image files”. The next step is to decide on what scale you want
the animations exported. If you want this new enemy variant to be roughly the same size as the default enemy then set this to 30% then click “batch export” then
choose or create a new folder for all of the animation frames to be exported to
and click Save. Now let’s get back into construct and double click the new enemy variant so we can import the new art. Find the animation frames pallet and
right-click on an empty spot inside and choose “import frames” and choose “from
files”. Now use the shift or ctrl key to multi select all the frames from the
animation and click open. Now delete the original frames. Repeat
this process for all animations until they are updated with the new art. Now go back to the first frame of the first animation and set its anchor point near
bottom center and copy it to all animations. Also edit the collision shape
to make it a clean rectangle shape with its bottom matching where the ground
should be, and copy that to all animations. The two frames of the
animation called “dewinged” are the first two frames of the “die” animation. As you
can see in my example i’ve created a variant of the basic enemy with spikes
on its back. If you look in its variables you’ll see one called
“top vulnerable”. Change this value to “NO” and you’ll see when you play the level
that the player gets hurt by landing on the enemy instead of killing it.
We can do the same thing with the flying enemy however we’ll have to overcome a
slight problem in the events. After we follow the same steps we did for the
ground-based enemy once the new spiked backed flying enemy is otherwise all set,
let’s go to the “level events” event sheet and search for “basic enemy” now find the
event that handles collisions between the player fireball and the flying enemy.
Right-click the leftmost edge of the event and choose “replace object”. Replace the fly enemy group with the flying enemy sprite. Now copy this entire event
and this time replaced the basic enemy sprite with the new spiked basic enemy
we had previously made. Now when you run the game you’ll see there are basic
flying enemies and spiked flying enemies and when hit they properly spawn their
wingless equivalents. Beyond these two basic enemy types the full version of
the Basic Platformer Game Engine provides an additional two. The first is
this stomping enemy. Just drag its sprite where you want it to start then set its
variable “timed or react” to either “TIMED” if you want the stop the enemy to
repeatedly stop then return to its original position regardless of the
player’s position or “REACT” if you want the stopping enemy to only stop if the
player is below it and within a certain horizontal distance from it. The stompy enemy has a jump through platform behavior leave this enabled if you want the
player to be able to land and walk safely on its back… or disable it if you
want the player to get hurt if they land on it. “Hrange” is the horizontal
distance in pixels the player must be within for stompy to stomp
If stompy is set to react mode. “Yunder range” is the vertical distance in pixels
the player must be within for stompy to stop if it’s set to react mode. “Damage”
is how badly stompy he will hurt the player if the player is hit by the
actual stomp motion. If the player hits Stompy while it’s not stopping then the
player loses the default one hit point. If you set damage to a high enough
number it will make the player die instantly. If they’re stomped on.
“Wait for stomp” is how many tenths of a second are counted before each
stomp after stompy gets back to its original position after the previous
stomp. “Countdown” is the actual variable used to count down from the wait for stomp value. This should be set to the same number as “wait for stomp” unless you have several stompies and you want them to be offset with each other in timing.
“Back up speed” controls how quickly stompy will go back up to its original
position after stomping. “Stomp speed” controls the speed of the actual stomp.
“Screen shake” controls how violently the screen will shake when the stomp occurs.
The second additional enemy is for the water. This fish enemy sprite is a
variant of the flying enemy except it doesn’t spawn a basic enemy when it’s
destroyed it automatically generates bubbles and it changes to a biting
animation when the player is nearby in front of it. Make sure when you place the
fish enemy you adjust its Z order to be behind the water tile base object and
adjust its sine wave movement so it does not swim through solid land or go
outside the water area it’s in. The “attack damage” variable controls how
badly the player gets hurt if the player touches the fish enemy while it’s
playing its biting animation. A future video will show how to add totally new
enemies and hazards from scratch. Thanks for watching.

Leave a Reply

Your email address will not be published. Required fields are marked *