Understanding cos & sin

BlitzMax Forums/BlitzMax Beginners Area/Understanding cos & sin

SuperStrict 

Global image:TImage = LoadImage("mouseloc.png")

'----------------------------------------------------------------------------------------
Global screenWidth:Int =800
Global screenHeight:Int =600
Graphics screenWidth,screenHeight',32',60

Global xpos:Double = 0
Global ypos:Double = 30
Global waveLength:Double = 10 ' bigger number smaller length
Global waveHeight:Double = 40.0 ' bigger number taller waves

' move horizontally
While Not KeyHit(KEY_ESCAPE)
	Cls
	xpos:+1
	ypos = Sin(xpos*waveLength)*waveHeight
	DrawImage image,xpos,ypos
	Flip
Wend

xpos = 100
ypos = 0

' move vertically
While Not KeyHit(KEY_ESCAPE)
	Cls
	ypos:+1
	xpos = Cos(ypos*waveLength)*waveHeight
	DrawImage image,xpos,ypos
	Flip
Wend