Parallax Scrolling

Morning everyone! I'm having an issue with my parallax scrolling, it works appropriately in game, EXCEPT that if I am colliding with something solid, and still holding down the move right or left key, the background continues to scroll, even though I'm not technically moving. Any thoughts on how to change that? Thanks for your time!

~Dessek

Comments

  • Night CabNight Cab Member Posts: 57
    edited February 2015

    Ok I think I got this...

    I made a quick little project based on your question. I created a game level BOOLEAN Attribute called ParallaxMove and set it to true.

    Then I created 3 Rules for the moving actor...

    Rule 1:
    If key Left is Down
    If key Right is Up
    Then Change Attribute Self.Motion.Linear Velocity X to Linear Velocity X-100

    Rule 2:
    If key Left is Up
    If key Right is Down
    Then Change Attribute Self.Motion.Linear Velocity X to Linear Velocity X+100

    (Rules 1&2 are so the Hero Actor can move left or right)

    Rule 3:
    If Self.Motion.Linear Velocity X (DOES NOT EQUAL ZERO)
    Change Attribute Game.ParallaxMove to false
    OTHERWISE
    Change Attribute Game.ParallaxMove to true

    Ok now...
    I set up another actor to display text (Game.ParallaxMove)

    When actor was sitting still it displayed TRUE
    When I had a key pressed and the Actor was moving it displayed FALSE
    When I had a key pressed and the Actor was STOPPED AT A WALL it displayed TRUE again

    So, even though I had a LEFT or RIGHT key pressed, BUT the actor was not moving because of a wall, it displayed TRUE. You should be able to apply this Attribute to your rule on moving your Parallax background.

    Hope this helps!

    NightCabStudio.com

  • ashtmjashtmj Member, PRO Posts: 405

    Here you go :)

Sign In or Register to comment.