Character sometimes moves beyond Move To limits

Hi - I have an actor in my game which is controlled by the left and right keys, jut the x axis. I use the 'Move To' behaviour and i've set the limits of the movement so the character stays on screen. However whilst i'm testing the game the character sometimes goes beyond the limits and goes off screen. Is this an issue with my choice of behaviour? Also will this happen when I eventually come to test it on iPhone? Thanks

Best Answer

  • SocksSocks London, UK.Posts: 12,822
    Accepted Answer

    This version you need to hold the keys down for the motion to continue (check out the rule within the otherwise section)

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    It's helpful to know that you are using a Move To behavior -- and yes, that particular one can sometimes have unpredictable results -- but you'll need to explain how you "set the limits of the movement."

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ekappleyard@gmail.comekappleyard@gmail.com Member, PRO Posts: 6

    @tatiang said:
    It's helpful to know that you are using a Move To behavior -- and yes, that particular one can sometimes have unpredictable results -- but you'll need to explain how you "set the limits of the movement."

    By that I mean I set the x and y coordinates that I want the actor to move to. Basically it just moves left and right controlled by the arrow keys. However sometimes, no telling why, it moves completely past the coordinates i've set

  • daaddddaaddd Member Posts: 116

    Use constrain position x, try doing the same thing on different ways :)
    Wish you well

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi ekappleyard@gmail.com try using >= and <= for your limits rather than just =; see if that solves it.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • SocksSocks London, UK.Member Posts: 12,822

    @ekappleyard@gmail.com said:
    Basically it just moves left and right controlled by the arrow keys

    Like @tatiang said, the Move To can be a little temperamental, if you want absolute-no-pass limits you could use the min/max functions, demo file attached - use the left and right arrows to move the actor.

  • SocksSocks London, UK.Member Posts: 12,822
    edited June 2015

    This version has a more inertia when you stop and start. (attached).

Sign In or Register to comment.