Powerset
Member
Hello! So I got some Enemy knockback working for my game. The only problem is im trying to transfer the logic into a script and im hitting major roadblocks. I cant seem to figure out whichever part of it im doing wrong. Inside the enemy hurt state I have this:
Its pretty basic and works as intended as by pushing the enemy back, the only problem is that its hard coded. I'm trying to create a script where I could easily change the variables of the height and the distance depending on the different attacks. So for my Knockback Script to be something like this:
The approach script doesn't work because its not doing it gradually in the step event. Should I be using GMS2 built in "x" and "y" inside the script? How should I go about this script exactly in pushing my Enemy back? Im pretty confused and the only thing I keep seeming to do is hard code this stuff. Any insight to this?
Code:
case ENEMYSTATES.HURT: {
sprite_index = sEnemy;
image_speed = 1;
hsp = Approach(hsp, 2, 0.3);
vsp -= 4;
}
Code:
function Knockback(_knockback, _knockbackHeight){
}