Movement question

0 favourites
  • 9 posts
From the Asset Store
Run and Jump in 3 Dimensions! Take your platformer to the next level!
  • How do you make a sprite move left whit the platform beahviorwhen it comes on screen pass the player and change to moving left when it passed the player and change to moving rigth again when it passed the player twice so it basically follows the player. I tried whit compare x but it doesn't change direction.

  • Havent tested it but try something like this

    "direction" global number variable at 0

    'On collision sprite with the player ' Event

    'add one to direction' action

    'direction is greater than 0' event

    'every (speed) seconds' event speed meaning lower decimal higher speed

    'simulate platform left' action

    'direction is greater than 1' event

    'every (speed) seconds' event

    'simulate platform right' action

    'set direction variable to 0' action

  • I guess I would do it something like this:

    Give the Sprite a variable Direction

    System pick sprite by comparison Abs(sprite.x-player.x) > 100

    -- Sprite.x < player.x

    Sprite set direction : "Right"

    -- Else

    Sprite set direction : "Left"

    Sprite compare variable direction = "Left"

    Sprite simulate platform pressing left

    Sprite compare variable direction = "Right"

    Sprite simulate platform pressing right

  • Havent tested it but try something like this

    "direction" global number variable at 0

    'On collision sprite with the player ' Event

    'add one to direction' action

    'direction is greater than 0' event

    'every (speed) seconds' event speed meaning lower decimal higher speed

    'simulate platform left' action

    'direction is greater than 1' event

    'every (speed) seconds' event

    'simulate platform right' action

    'set direction variable to 0' action

    'every (speed) seconds' event speed meaning lower decimal higher speed

    How do you create this event? I used compare speed and i couldn't write in that. How do you write in that? Do you use another type of event?

  • I would like to have a clearer vesrion of the previous answer or a new answer.

  • I would like to have a clearer version of the previous answer or a new answer.

  • I would like to have a clearer version of the previous answer or a new answer.

  • I would like a answer.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sprite: x < player.x

    --- Sprite: simulate platform pressing right

    Sprite: x > player.x

    --- Sprite: simulate platform pressing left

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