Hi guys,
So I'm learning Construct 3 being new in game development & I'm trying to learn it by making a simple platform game wherein the player has to go through levels and beat enemies to win the game.
I'm currently facing a problem with player knockback when it's hit by an enemy sword.
I'm pasting the screenshot of the event sheet where the logic of knockback is written below -
I'm using sprite boxes for player, enemy, player sword & enemy sword so basically the idea is if the enemy attacks the player, the player will take a hit, flash & have a knockback if the player's X is less than the monster's x then the player's X vector is set to -400 from current X & if player's X is greater then monster's X then player's X vector is set to +400 from current X.
However this code is not working as I think it should, instead please see the video below of what's happening -
So basically, when the player is standing on the left side of the screen from the monster (Player's X is less than Monster's X) the player is getting knocked back into the monster rather than getting pushed behind, however, it's correct when it's the other way around. Also for some reason, the knockback animation is not getting played every time only sometimes.
I've tried a lot of conditions but I know I'm doing something wrong here just not able to figure it out maybe that's not how you do a knockback? Can someone please help & point me in the right direction?
Thank You!