Oscillating motion using MOD

sparkzillasparkzilla Member Posts: 152
edited November -1 in Working with GS (Mac)
Hi I'm trying to use the MOD function to make a horizontal line come up from the bottom of the screen and then reverse direction when it hits 20 pixels. I've tried lots of combinations but no luck :-(

Spawn actor at position y=0 direction 90degrees (up)

Change attribute game.linetoggle =(self.position.Y)%20
When game.line toggle = 1
Change velocity direction 270degrees (down)
OTherwise
Change velocity direction 90degrees

RESULT: The line moves from the top of the screen to the bottom instead of from the bottom, up 20 and then back.

Does the initial change attribute need to be in a timer?

Comments

Sign In or Register to comment.