E
Elkrom
Guest
hello I am trying to fix this knock-back effect on my enemy instances that I've implemented , basically using recycled code that i already had from a recoil effect from shaun spalding's platformer series (which I'm starting to think might not be the best way), and its kind of working but it looks like it's just jumping/teleporting back x amount of pixels rather than bouncing back smoothly. I'm wondering what i can do to achieve this effect and also what i can do to add a "knock-back frame" on the enemy. as in switch to a seperate sprite briefly as its being knocked backwards. watch "implementing game feel in archvale" if you want to see the effect i am talking about. but to be clear my game is a platformer not a top down rpg. thanks in advance this is my third post on here and ive had great feedback everytime.
[// Enemy Variables
vsp= 0;
hsp = 0;
move=0;
gunkickx=0;
gunkicky=0;
//Enemy step event
case e_state.idle:
{
hsp=(0) + gunkickx
gunkickx = 0;
vsp = (vsp + grav) + gunkicky;
gunkicky = 0; ]
and this is in the begin step event for my bullet object
[ if (place_meeting(x,y,pshootable))
{
with (instance_place(x,y,pshootable))
{
hp --;
hitfrom = other.direction;
gunkickx = lengthdir_x(20, other.image_angle)
gunkicky = lengthdir_y(20, other.image_angle)
}
instance_destroy();
}]
[// Enemy Variables
vsp= 0;
hsp = 0;
move=0;
gunkickx=0;
gunkicky=0;
//Enemy step event
case e_state.idle:
{
hsp=(0) + gunkickx
gunkickx = 0;
vsp = (vsp + grav) + gunkicky;
gunkicky = 0; ]
and this is in the begin step event for my bullet object
[ if (place_meeting(x,y,pshootable))
{
with (instance_place(x,y,pshootable))
{
hp --;
hitfrom = other.direction;
gunkickx = lengthdir_x(20, other.image_angle)
gunkicky = lengthdir_y(20, other.image_angle)
}
instance_destroy();
}]