How do I make an object that moves in a square pattern?

Get help using Construct 2

Post » Fri Jan 27, 2017 4:11 pm

I know how make it move in a circle pattern (by giving the object two sine behaviours, setting the periods to the same values and magnitudes to the same values, but making the offset of one of the behaviours one-fourth of the period) and I tried changing the wave properties of the sine behaviours to triangle, and it did make the movement square shaped, but it was a tilted square, so more of a diamond shaped pattern.

Any help with this would be nice! :mrgreen:
B
24
S
9
Posts: 112
Reputation: 2,010

Post » Fri Jan 27, 2017 6:06 pm

Introduce an instance variable
SQ_MOVEMENT.

_________ | Set SQ_MOVEMENT to floor( Time % 4)
This will cause SQ_MOVEMENT to be reset 0,1,2,3,0.... infinitely.

Then give it a custom movement,bullet or use lerp for each state.
Decide which one you'll use then do this:

SQ_MOVEMENT = 0 | [Move Right]
SQ_MOVEMENT = 1 | [Move Down]
SQ_MOVEMENT = 2 | [Move Left]
SQ_MOVEMENT = 3 | [Move Up]
Image Image Image
B
32
S
12
G
27
Posts: 761
Reputation: 17,244


Return to How do I....?

Who is online

Users browsing this forum: DolyGamesCosmos and 22 guests