Help with character animation/movement

0 favourites
  • 7 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I have an NPC that follows the player character and when they move left and right it is fine. When the character moves up and down it will choose either to just play the "Up"/"Down" animation or it will move up/down (with no animation). How come it works just fine when it is left and right but when it is up and down it won't work? (The code is identical for the left/right/up/down just with their respective animation/movement)

  • How can anyone possibly answer this question without seeing your code or capx file?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • here is the code! sorry, I wrote that at school and I could not take a photo on my computer there.

  • This code makes no sense.. Even with only 1 enemy instance it will not work correctly. When you are near the enemy, the player will start moving by itself, running away up/down from the enemy. If there are multiple enemies on the layout, I can't even imagine what it will do...

    .

    Please explain how the player should be controlled (keyboard, on-screen virtual joystick etc), and how do you want it to be animated. Why are you comparing player position with enemy position? Should the animation change somehow when there is an enemy nearby?

    Also, check out these tutorials:

    construct.net/en

    construct.net/en

    construct.net/en

    construct.net/en

  • Here is a larger portion of the code. The rest is working just fine so I did not include it. The game so far already has over 100 events so I could not fit it all anyway. The Player character is just controlled with the up, down, left and right key and all of the animations that correspond with those work just fine. When the enemy goes left/right it will play the animation AND do the movement. When it goes up/down it will play the animation OR the movement. Is this because it is a sub event? It was the only way I could code it so the enemy could even do any actions at all in all four directions.

    I also tried the code this way but the same error occurs

    Thanks!

  • Oh, that icon is actually the Enemy sprite! From your first screenshot I thought it was the player, sorry for that.

    Here is an easier way to do what you want:

    dropbox.com/scl/fi/ckhqhmui664ui5wpjb5d2/ChasingEnemy.capx

  • Oh, that icon is actually the Enemy sprite! From your first screenshot I thought it was the player, sorry for that.

    Here is an easier way to do what you want:

    https://www.dropbox.com/s/xyqy64n9qlwd87f/ChasingEnemy.capx?dl=0

    Thank you so much! Sorry for the confusion at the beginning, but I am happy my problem is fixed now :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)