For our Enemy we will need 2 Instance Variables;
That’s done open your
Enemy Events
and add these lines
If you study these lines it will be understandable what we are asking Construct 2 to do?
Remember we created instance variable
Enemy_Health = 16
Enemy_State = IDLE
We will put into
practice
below:
Now we must check for our player Knife has
hit the Enemy?
Now we cannot have only one ENEMY, let’s spawn more for our player to enjoy himself or her. Create sprite 32 x 32 and leave it BLANCK and name it
spr_Enemyspawn
Now add lines below:
As you can see I have used CHOOSE (This is same as randomly selected seconds). It is entirely up to you but I like this method because player will never know when new Enemy being spawn. So our player will not be ready to shoot or aware of it.
Now if you RUN and test it you will notice that enemy health bar is not spawn with our Enemy. Here is how you accomplish this select both Enemy and health bar than scroll down in property and click on create container. This will accomplish our goal.
Now we will add sprite and name it spr_Items
ID_1
ID_2
Add Instance Variable below
Item_ID = 0