Game Maker Studio: How to Create Variables & Enemy Direction Follow.
Visit my anime and game site: http://mcanime1.wixsite.com/mcanime
Update 8/6/17: Next weekend, I will post a (NEW! video) on how to move character in all 4 directions, facing and shooting in the 4 different directions, shoot barrel, moves a little, then stops, and keeping your ammo count static, not attached to character.
Update 8/6/17: Coming Soon: Wall Jump, Water, Create a Boss and Boss Complete Custom Health Bar, Score, Score Board, Health bar above objects, Inventory with a number count, Target Shooter.
GMX File: https://goo.gl/km2iTX
Enemy Follow code: https://goo.gl/BNHtV7
hitit, check solid:
Events:
Create
Actions:
Var, grab it from the Control tab, this is the enemies health which is set to 16
inside the Var, it will say Set Variable
Set to Self
Variable: enemyhealth
Value: 16
Grab another Set Variable
Set to Self
Variable: maxenemyhealth
Value: enemyhealth
Events:
Collision with bullet, which is ammo for the code
Grab Set Variable
Set to Self
Variable: enemyhealth
Value: -1
Relative make sure its checked, otherwise the hitit will not expode after so many shots.
Grab Test Variable from the Control tab,
Set to Self
Variable: enemyhealth
Value: 10
Operation: Less then
Change Instance to lasthit, perform yes
Events:
Collision with bulletammo2, which is ammo2 for the code
Grab Set Variable
Set to Self
Variable: enemyhealth
Value: -1
Relative make sure its checked, otherwise the hitit will not expode after so many shots.
Grab Test Variable from the Control tab,
Set to Self
Variable: enemyhealth
Value: 15
Operation: Less then
Change Instance to lasthit, perform yes
Lasthit is the left over parts that was exploded from the barrel which, is called hitit, Be sure the cross hairs is in the middle of object, so that the effects will be centered on object and in the correction location:
Events:
Create
Actions:
Expode sound
Start moving direction set to not moving, speed 0
Create a smoke up at (0,0) get this from draw tab called Create Effects
Create a smoke up at (0,0)
Create a explosion at (0,0)
Be sure all effects are set to Relative.