How do you make a 8 direction sprite change direction?

  • For example if i want to make my sprite move to the left in two seconds but then move down. I have tried alot of things to make it work but the sprite won't change direction. So how do you do it?

  • I'm not sure what you mean..

    Something like this?

    https://dl.dropboxusercontent.com/u/485 ... ction.capx

  • I'm not sure what you mean..

    Something like this?

    https://dl.dropboxusercontent.com/u/485 ... ction.capx[/quote > > If i give a sprite the 8 direction behavior and make the event is on screen and follow it up whit the action simulate control left and simulate control down. Now the sprite moves diagonally left and down. Then i want the sprite to move diagonally up and left after tre seconds has passed. How do i make that work? I have tried multiple things but i can't make it change direction. Is this clear enough?

  • > I'm not sure what you mean..

    > Something like this?

    >

    > https://dl.dropboxusercontent.com/u/485 ... ction.capx[/quote > > > > If i give a sprite the 8 direction behavior and make the event is on screen and follow it up whit the action simulate control left and simulate control down. Now the sprite moves diagonally left and down. Then i want the sprite to move diagonally up and left after tre seconds has passed. How do i make that work? I have tried multiple things but i can't make it change direction. Is this clear enough? > > > What part of my capx don't you understand? I just added randomness, but if you set the direction directly instead of choose, you can get your wanted effect..

  • I'm not sure what you mean..

    Something like this?

    https://dl.dropboxusercontent.com/u/485 ... ction.capx

    The capx was helpful and made me get a good idea of how to change 8 direction sprites direction. But i want the sprite to move diagonally down and left in 3 seconds and move diagonally up and left in 3 seconds and then reapeat the process all the time. How do i do that? The capx didn't help on that part enough.

  • I didn't think that would be hard..

    Just a bit of basic programming..

    on start of layout -

    set the timer for 3 seconds

    sprite set direction = 3

    timer on timer > set timer for 3 seconds

    -- sprite.direction = 3

    sprite set direction to 9

    -- else

    -- sprite.direction = 9

    sprite set direction = 3

  • I didn't think that would be hard..

    Just a bit of basic programming..

    on start of layout -

    > set the timer for 3 seconds

    > sprite set direction = 3

    timer on timer > set timer for 3 seconds

    -- sprite.direction = 3

    > sprite set direction to 9

    -- else

    -- sprite.direction = 9

    > sprite set direction = 3

    It worked. But if you want you can answer a follow up question. How do you make the sprite move in one direction longer then the other?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I guess you could set the timer to a different number depending on the direction?

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