Projectiles and deathcheck
|
|
Code:
world map_format = ISOMETRIC_MAP
mob icon = 'Player.dmi' icon_state = "player" density = 1 var hp = 10 maxhp = 10
Login() loc = locate(58, 67, 1) usr.verbs+=new/mob/verb/shoot() mob enemies zombie icon = 'Enemies.dmi' icon_state = "zombie" density = 1 hp = 5 maxhp = 5 mob proc DeathCheck() if(src.hp<=0) del src
mob verb shoot() var/obj/Bullet/B=new(src.loc) B.icon='Bullet.dmi' walk(B,usr.dir) obj Bullet density = 1 var range = 20 Move() ..() src.range-=1 if(range<=0) del src Bump(B) if(ismob(B)) for(var/mob/enemies/Z) Z.hp-=1 Z.DeathCheck() del src else del src
|
Problem description:
Alright so I have it so my player can shoot bullets at a zombies and kill them. My problem is though whenever a 5 bullets hits a zombie it doesn't kill that zombie that got hit by the bullet it kills a random zombie and not the one that got hit. Can someone please explain to me what I'm doing wrong in as much detail as you can so I can try and fix this?
EDIT: Also if you see anything else that is wrong that I'm doing or any tips you could add would be helpful also!
|
This loops through all enemies in the world. You might want to leave that line away and only do: