Orbiting script

Previous topic - Next topic

badrush

Yep yep if you need some orbiting here you go

GOSUB makevars

main:
  GOSUB step_event
  GOSUB DRAW
GOTO main

SUB makevars:
GLOBAL x1 = 200
GLOBAL y1 = 200

GLOBAL x2 = 200
GLOBAL y2 = 200

GLOBAL length=100
GLOBAL direction=0
  LOADSPRITE "ball.bmp" ,0

ENDSUB // MAKEVARS




// ------------------------------------------------------------- //
// ---  STEP_EVENT  ---
// ------------------------------------------------------------- //
SUB step_event:
x2=x1+COS(direction)*length
y2=y1+SIN(direction)*length
direction=direction+5
ENDSUB // STEP_EVENT







// ------------------------------------------------------------- //
// ---  DRAW  ---
// ------------------------------------------------------------- //
SUB DRAW:
ALPHAMODE 0
DRAWSPRITE 0, x1, y1
DRAWSPRITE 0, x2, y2
SHOWSCREEN
ENDSUB // DRAW