Character moving left to right

0 favourites
  • 12 posts
From the Asset Store
A complete set of graphical user interface (GUI) to build 2D video games. With wood, nature, & jungle theme
  • can someone please help me out here trying make character run left to right every tick

    . Thanks

  • Is it just a constant back and forth motion? It may just be easier to use the Sine behavior to simulate this.

  • you mean you want your hero move left and right when you press a key? this is what i do when i want the player move left and right:

    i add platform behavior to the player

    event : touch - is touching for example left ( left here is the name of my left arrow ) ?action : player : set animation to "running"

    player : set mirrored

    player : Simulate Platform pressing left

    and the same thing to make your player move to right

  • Is it just a constant back and forth motion? It may just be easier to use the Sine behavior to simulate this.

    yes constant back an forth like every touch i want him to go left or right ... the way i have it right now it only goes to where ever i click

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm, not sure I'm understanding this correctly. Are you trying to make it so the player never stops moving and keeps going left to right and back? How does the controls work?

  • Hmm, not sure I'm understanding this correctly. Are you trying to make it so the player never stops moving and keeps going left to right and back? How does the controls work?

    like i want the player to move left or right when every i touch the screen ... so lets say hes going right an i touch the screen he needs to go back left like that... i been trying this for a weeks now still no good only go where ever i touch an stays

  • The way it is on the screenshot should work as far as I can tell. Can you upload your .capx so I can test?

  • The way it is on the screenshot should work as far as I can tell. Can you upload your .capx so I can test?

    https://drive.google.com/open?id=0B_0uNw5oNXJGcmJ4aUhpNktZemM

  • lol darn, I only have version 227 of Construct so I can't open it

    Does it still have the same problem if instead of 8-Direction movement you just put "Set Player.X to Player.X+1/-1" to make it move?

  • lol darn, I only have version 227 of Construct so I can't open it

    Does it still have the same problem if instead of 8-Direction movement you just put "Set Player.X to Player.X+1/-1" to make it move?

    Yah still does the same thing where ever I touch he just moves to that spot until I click somewhere else again

  • Well, your code does exactly what it is supposed to do.

    It takes a X as target and will move your object until it reached that destination.

    What you are wanting is far simpler.

    You want, on click, to change the direction of the object.

    So by default have it going in a direction.

    On touch, change the value of the direction.

    The object is now moving the other direction.

    It gives :

    When dir is = 0, move the object to the right.

    When dir is = 1, move the object to the left.

    On touch, modify the value of dir so that it is either 0 or 1.

  • Well, your code does exactly what it is supposed to do.

    It takes a X as target and will move your object until it reached that destination.

    What you are wanting is far simpler.

    You want, on click, to change the direction of the object.

    So by default have it going in a direction.

    On touch, change the value of the direction.

    The object is now moving the other direction.

    It gives :

    When dir is = 0, move the object to the right.

    When dir is = 1, move the object to the left.

    On touch, modify the value of dir so that it is either 0 or 1.

    thanks a lot bro you really help me there you don't even know man thanks a lot really an truly

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