GameMaker how do i track an enemy in gms2?

K

kassmass

Guest
so i wanted the player to get money for each pointless murders they have commited, and i tried doing it but it tracked all the enemies, and i dont get money unless i kill all enemies, can someone help?
 

Bentley

Member
He's saying to add the destroy event to your enemy.
Then you could:
Code:
// Assuming you have one instance of obj_player
o_player.cash += something;
You might want to check if the player exists first to prevent an error if the player dies before the enemy dies.
 

Yal

šŸ§ *penguin noises*
GMC Elder
Yeah, put your code in the enemy's destroy event... then you could customize it even more, so different enemies drop different amounts of money (rich people drop more money, nurses could drop medkits instead, etc)
 
Top