0 Favourites

How do I Animate a Position Change

  • Hello I'm doing my very first game and i have a problem:

    I have a key event that makes some objects changing positions (100px in Y or X, for example) but they do it in one tic, and I wanna animate the change, I tried to put an animation so on the key event firts play the animation and then change the position, but then my objects firsts made the change position and then the animation or vyceversa, and allways with a ugly "jump" effect....

    anyone knows what could I do?

    thanks

  • It's a little hard to answer without more specifics. If the movement and the animation events are triggered by the same Condition, u need to define a separate condition to trigger the animation event after.

    Is the animation suppose to happen before, during, or after the move?

    what behavior are you using to move the sprites?

    Is the move random 100px or do you know the position the sprite will stop on in advance?

    Is the animation looping?

    If I understand you correctly, and the animation is not looping, it could work like this

    Some Condition > Sprite Play Animation

    Sprite On Finished>Sprite set position

    On finished refers to the animation and needs to be a sub event of the initial condition.

    Try to be more specific and answer the above questions and I'll try to give you a better solution.

  • It's a little hard to answer without more specifics. If the movement and the animation events are triggered by the same Condition, u need to define a separate condition to trigger the animation event after.

    Is the animation suppose to happen before, during, or after the move?

    what behavior are you using to move the sprites?

    Is the move random 100px or do you know the position the sprite will stop on in advance?

    Is the animation looping?

    If I understand you correctly, and the animation is not looping, it could work like this

    Some Condition > Sprite Play Animation

    Sprite On Finished>Sprite set position

    On finished refers to the animation and needs to be a sub event of the initial condition.

    Try to be more specific and answer the above questions and I'll try to give you a better solution.

    Oh! First of all, thanks for answering!!

    Second, sorry for being not as specific as the question needs, the problem is that english is not my mother language and sometimes is hard to me to find the proper words to expres some technical things, sorry, really.

    I think that your answer will help me, but anyway I will try to explain my situation a little further:

    this is the thing, more or less:

    I have several objects that move alike, but let's focus on the player

    You can only move up and down in some specific pixels (93, but let's say 100px), so when you push up, you change your Y position in yourYposition + 100, and when you push down the same but -100.

    In my test game by the moment, you just "appear" 100px up or down, and what I want is that the player "moves" 100px up or down, and is important for me that it happens in just one key presion. (like if you where on a menu, and you navigate up or down between the selecting options).

    In my very first thought I think about making an animation, so when you click up, you play the animation witch emulates the transition for the position change, and then make the position change somethink like

    When CLICK UP ->Player animation "up"

    Player move on angle 270 - 100px.

    But it doesn't work properly....

    Now I will try what you answered me and let you know about the result

    regards, and many many thanks you!!

  • I understand what he wants but have no idea how to do it myself, I've just decided to just let the player "jump" since in my game it's in smaller increments(20px I think) so it doesn't look to weird.

    Anyway, what he wants Dom, imagine every FPS you've ever played for example, in those games when you see an object(lets take a human for this example) move from point A to point B, you see him walking/runing there, right? And this transition from point A to B while playing a walk animation can be a smooth and as slow as the dev wants, pixel by pixel. What happens to him is the animation plays in point A and then the object just dissapears from A and appears in B. Like in Flappy Bird for example.

    Hope I'm explaining it better.

    I think the "How to make a platformer" tutorial could help you Arlys if you're trying to make a walking/runing transition, but for other objects/movements I have no idea mate, sorry.

    / tutorials / 253 / how-to-make-a-platform-game (delete the spaces between /)

  • is this a platformer? or a top down? What behavior are you using to move object or player? Need to know to provide solution.

    Why don't you PM me the capx.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Hello!

    I found a solution that works for me, maybe is not the best, but by the moment it will be enought.

    TheDom, by the moment I don't wan't to bother you more with this issue, but thanks for being so kind!!!

    regards

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