'terminology'
Your character has x and y variables, right?
Suppose we want to have an 'option' circling around it (ever played Gradius?) then this option has its own x and y coords. And at each game-update you update this option's x/y coords.
The most flexible way is creating a lookup table for the optionpath, this way you can also easily create 8-figures, triangles, squares etc.
Create 2 arrays:
pathx(99)
pathy(99)
for 100 phases
then fill them with a circle-path
for t=0 to 99
pathx(t)=sin(t*360/100)*40
pathy(t)=cos(t*360/100)*40
next
'40' being the distance here, create an elipse by using different values for the x distance and y distance
If you want more spooky figures, try this:
pathx(t)=sin((t*a)*360/100)*40
pathy(t)=cos((t*b)*360/100)*40
use integer values for a and b ..
In the game:
in your mainloop, have some phase variable which is updated at each game-update, and make sure it moves between 0 and 100:
phase=(phase+1) mod 100
Then at the drawing:
; draw player at X,Y
; draw option at X+pathx(phase),Y+pathy(phase)
c'est ca..
haven't tested it btw ^___^ good luck with it..
Your character has x and y variables, right?
Suppose we want to have an 'option' circling around it (ever played Gradius?) then this option has its own x and y coords. And at each game-update you update this option's x/y coords.
The most flexible way is creating a lookup table for the optionpath, this way you can also easily create 8-figures, triangles, squares etc.
Create 2 arrays:
pathx(99)
pathy(99)
for 100 phases
then fill them with a circle-path
for t=0 to 99
pathx(t)=sin(t*360/100)*40
pathy(t)=cos(t*360/100)*40
next
'40' being the distance here, create an elipse by using different values for the x distance and y distance
If you want more spooky figures, try this:
pathx(t)=sin((t*a)*360/100)*40
pathy(t)=cos((t*b)*360/100)*40
use integer values for a and b ..
In the game:
in your mainloop, have some phase variable which is updated at each game-update, and make sure it moves between 0 and 100:
phase=(phase+1) mod 100
Then at the drawing:
; draw player at X,Y
; draw option at X+pathx(phase),Y+pathy(phase)
c'est ca..
haven't tested it btw ^___^ good luck with it..