I'm trying to make a damage system (similar to fighting games) using my own idea.
When I hit the enemy, I want the enemy to retrieve the player's 2 instance variables' values for attack velocity (X for horizontal and Y for vertical) while at the same time, I disable the gravity. This involves pushback, pulling the enemy towards the player, slamming down enemy and hitting up enemy (like an uppercut).
Right now, I am trying first a simple pushback (enemy should move only horizontally, no vertical movement).
Enemy has platform behavior of course.
Notes:
X velocity and Y velocity are instance variables of Player
Facing is also an instance variable of Player. It is set to 1 if the player is facing right, and -1 when player is facing left.
Now I did it by
[quote:eb0bh0em]+Player's attack animation is playing
+frame = 2
-> set X velocity to 60
-> set Y velocity to 0
+Player is overlapping with enemy object
->Enemy: Set animation to Hurt
->Enemy: Set Vector X to Player.X Velocity*Player.facing (this means the attack should push in the direction the player is facing)
->Enemy: Set Vector Y to Player.Y Velocity
->Enemy: Set Gravity to 0
The enemy moves (being pushed), but the problem is, even if I set the X Velocity to any number other than 60 (I tried a ridiculously high number like 5000000000), the enemy still moves the SAME DISTANCE. So that means, I don't know if this is actually working or not. I want the pushback velocity to be changeable (based on the X Velocity variable), since different attacks have different pushbacks.
So should I use "Set max speed" or what?