How do you make a 8 direction sprite change direction?

Get help using Construct 2

Post » Thu Dec 03, 2015 7:48 am

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?
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Thu Dec 03, 2015 9:23 am

I'm not sure what you mean..
Something like this?

https://dl.dropboxusercontent.com/u/485 ... ction.capx
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Dec 05, 2015 10:50 am

[quote="LittleStain"]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?
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Sat Dec 05, 2015 10:55 am

Calfuso wrote:
LittleStain wrote: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 told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Dec 05, 2015 2:53 pm

LittleStain wrote: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.
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Sat Dec 05, 2015 3:14 pm

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 told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Dec 05, 2015 4:42 pm

LittleStain wrote: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?
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Sat Dec 05, 2015 4:46 pm

I guess you could set the timer to a different number depending on the direction?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, cb130felix, jorgmaquoi, Kermad, Lancifer, piddlyPoo, Yahoo [Bot] and 5 guests