Move to touch problem

i have a actor that move to where you touch while staying on the same y axis. Bu when ever i start the game the actor automatically goes to 0 since here is no touch yet. :| Does anyone have any suggestions.

Comments

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

    Give the instance of the actor a self.Position.X value. And make sure your constrain behavior is inside of a When Touch is Pressed rule.

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

  • I_AM_BENJII_AM_BENJI USAMember Posts: 40

    @tatiang‌

    have a different set of rules.
    I have a timer

    Timer
    every 0 secs

    move to touch x , 70(where the actor is)
    the timer was set so it is constant.

    so any suggestions

  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375

    Cant you just constrain its x position to the attribute?

  • I_AM_BENJII_AM_BENJI USAMember Posts: 40

    @bjandthekatz said:
    Cant you just constrain its x position to the attribute?

    i can but since it starts off at 0 it will still happen

  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375

    When mouse button is down
    change attribute self.pos.x to game.touch.touch1.x

    This worked in a quick demo.

  • I_AM_BENJII_AM_BENJI USAMember Posts: 40

    never mind i fixed it
    i made a actor as my background
    in the background in made a rule if touched is pressed change attribute move to true otherwise change attribute move to false.

    then in the player I made a rule
    if move is true then move to touchx, 70 otherwise change attribute self.position.x to self.position.x

Sign In or Register to comment.