Enemy Death Direction

F

FinnFTW

Guest
So in my platform shooter, when i kill an enemy, the death animation is the same every time (When i kill him from the right, the blood splat stays on the left). I just want to know what to do because honestly I'm stuck.

Thanks in advanced!
 
D

Diveyoc

Guest
Not sure about a platformer but this is what I use in a top down game.
I used this in the create event of my blood effect. It makes the blood splatter go in the same direction as the attacking object such as a bullet.
I only added some slight randomness, but you could experiment with it.

Code:
rr = random_range(-20, +20);
direction = (obj_bullet.image_angle + rr);
image_angle = direction;
 
F

FinnFTW

Guest
Not sure about a platformer but this is what I use in a top down game.
I used this in the create event of my blood effect. It makes the blood splatter go in the same direction as the attacking object such as a bullet.
I only added some slight randomness, but you could experiment with it.

Code:
rr = random_range(-20, +20);
direction = (obj_bullet.image_angle + rr);
image_angle = direction;
So i tried this, and this error popped up when it hit the bad guy


___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object obj_bad_die:

Unable to find any instance for object index '2' name 'obj_bullet'
at gml_Object_obj_bad_die_StepNormalEvent_1 (line 2) - direction = (obj_bullet.image_angle + rr);
############################################################################################
 

TheBroman90

Member
I don't really understand what you want to achieve with the death animation.
Do you want blood somewhere specific or just random? Can you show some code?

That error message says that you don't have an obj_bullet in your game.
 
D

Diveyoc

Guest
Change obj_bullet to whatever your object is named. That was just the example.
It looks like it should be the bad_die object.
direction = (obj_bad_die.image_angle + rr);
 
F

FinnFTW

Guest
The bullet is called obj_bullet, and what im trying to acheive is the direction i shoot, that is where the enemy will get "shot". like if i shot an enemy, the wound will be shown on the side that i was facing
 
Top