Enemy's Platform movement without gravity?

0 favourites
  • 1 posts
From the Asset Store
In this template the music plays without looping in your game
  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)