Rotate and move
Root / Programming Questions / [.]
Z_E_R_OCreated:
To get a sprite to rotate towards a specific random point you'll have to check a conditional and rotate the sprite a certain amount each loop iteration after choosing the final rotational degree. I'm not sure how to make it move in a direction using a degree.
Rotational code:
WHILE 1 'Game loop. You can put this in a DEF function (or just paste it) and use it elsewhere. IF #A AND BUTTON(3) THEN IF R<=0 THEN 'Start a new rotation after the last one completes. R=RND(360) ROTSPEED=RND(4) 'Optional, use if you want to rotate the sprite at a random speed each time. ENDIF IF R>0 THEN SPROT ID, R DEC R,ROTSPEED 'Spacing after punctuation may be a good idea but whatever ENDIF ENDIF VSYNC WENDWhen you press A, the sprite will rotate randomly. Be sure to set up the necessary sprite(s) and variables.