How to play both Idle and running animation without flickering effect?!

So I'm working on a Platform game where I am moving my character left and right as well as jumping. I've got the running animation playing when I move left/right and Idle animation when I stand still, which is working fine. However, the only issue I'm having here is that when I move left and right I keep seeing that the Idle animation keeps playing over it and creates a flickering effect which ruins the running animation. I was wondering if there was a way to stop the Idle animation images from playing and only allow the running animation until I stay still. When jumping the jump animation plays perfectly but it's always a problem with moving left/right.
I've done everything I could but I'm not getting the results I'm looking for. If there's anything I did wrong that should be corrected, I'd like to know so that I can have these animations play correctly!!

Here's a demonstration of the issue I'm having:

Here are two screenshots of my settings if it helps too:

Settings for running animation:
https://drive.google.com/open?id=0B-lJpxbDBNVoTVlXcEdWVlBuZ2c

Settings for Idle Animation:
https://drive.google.com/open?id=0B-lJpxbDBNVoY2tIOXRaWTNWTHM

Any insight on this that will help fix this and make my animation run smoothly is appreciated. Thanks!!

Comments

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited January 2017

    @kingofhackers101@gmail.com welcome to the forum!

    As you rightly noticed, when running, both the "not jumping/thus idle" and the "running" conditions are true, making their animations overlap.

    **Simple **fix would be to nest the conditions:

    Rule: If Right pressed
             Run right animation
    else
             Rule: If Left pressed
                      Run left animation
             else
                      Rule: If Jump pressed
                               Jump animation
                      else
                               Idle animation
                      end rule
             end rule
    end rule
    

    But, maybe look at some tutorial series on doing platformer movement, e.g.

  • Chestosneako IncChestosneako Inc Member Posts: 25
    edited January 2017

    @Hopscotch said:
    @kingofhackers101@gmail.com welcome to the forum!

    As you rightly noticed, when running, both the "not jumping/thus idle" and the "running" conditions are true, making their animations overlap.

    **Simple **fix would be to nest the conditions:

    Rule: If Right pressed
             Run right animation
    else
             Rule: If Left pressed
                      Run left animation
             else
                      Rule: If Jump pressed
                               Jump animation
                      else
                               Idle animation
                      end rule
             end rule
    end rule
    

    But, maybe look at some tutorial series on doing platformer movement, e.g.

    The video didn't help with results I was going for, but I followed the settings you provided me in text and I was finally able to make the running animation play smoothly for both sides without looking glitchy. BUT... I now have developed another issue!!!

    My idle animation isn't animating this time when I stay still and whenever I "Tap" the space bar to jump the Jumping animation doesn't play the entire frames UNLESS I "Hold" the space bar, it just cuts in the middle after I release it only when tapping. I also used to jump while running back and forth but now I can't do that either, I can only jump while I'm Idle but not when I'm running. I need some help on how to fix this if you know what else I should do next.

    I will show you the changes I made according to what you demonstrated me in your last post:

    RULE: Receives a key press: right is: UP
    Receives a key press: left is: UP
    Receives a key press: jump is: UP

    DO: Change Attribute: self.motion.linearVelocityX - To: 0
    Change Attribute: game.direction - To: null

    ELSE:
    Rule: Receives a key press: right is: DOWN

    DO: Change Attribute: self.graphics.flipHorizontally - To: false
    Constrain Attribute: self.motion.linearVelocity.x - To: 250
    Change Attribute: game.direction - To: right
    Run right animation
    ELSE:
    Rule: Receives a key press: left is: DOWN

    DO: Change Attribute: self.graphics.flipHorizontally - To: true
    Constrain Attribute: self.motion.linearVelocity.x - To: -250
    Change Attribute: game.direction - To: left
    Run Left animation
    ELSE:
    Rule: Receives a key press: Space is: DOWN
    IF: self.jumpCount > 0

    DO: Change Attribute: self.jumping - To: true
    Change Attribute: self.jumpCount - To: self.jumpCount-1
    Change Attribute: self.motion.linearVelocity.y - To: 656
    Jumping animation
    ELSE:

    IDLE animation

    end rule

  • Chestosneako IncChestosneako Inc Member Posts: 25
    edited January 2017

    And here is another rule I have with my character as well:

    Rule:
    IF: actor overlaps or collides with: actor with tag - Solid

    DO: Change attribute: self.jumping - To: false
    Change attribute: self.jumpCount - To: self.jumps
    ELSE:
    Change attribute: self.jumping - To: true

    end rule

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @Chestosneako Inc

    That is why I said watch the tutorial series. :)

    Good movement with animation is a bit more complicated, both to control the correct animation and also (as you have seen) to let the animation continue while player is in a certain state.

    This means that one ideally works with game states, stored in attributes, to separate the key presses from the actual behavior.

    I will point you to another series of tutorials to look at which is probably closer to what you want to achieve. They are quite a bit more complex, but will give you much more control.

Sign In or Register to comment.