Is this what your looking for? It wouldn't work with an image though because you would need to roate the image or use frames, unless you wanted to emulate 2d images with sprites, in which case its just pointentity().
Graphics 640,480
SetBuffer BackBuffer()
;W,A,S,D keys to move around
;the players ship always points at the mouse
Type player
Field x,y
Field xv#=0,yv#
Field a,s#
Field strafe#
End Type
p.player=New player
p\x=200
p\y=200
;;MAIN LOOP;;
While Not KeyDown(1)
Cls
GetInput()
UpdatePlayer()
Flip
Wend
End
Function GetInput()
For p.player=Each player
If KeyDown(17)=True Then p\s=p\s+.2
If KeyDown(31)=True Then p\s=p\s-.2
If KeyDown(30)=True Then p\strafe=p\strafe+.2
If KeyDown(32)=True Then p\strafe=p\strafe-.2
If p\s>0 Then p\s=p\s-.1
If p\s<0 Then p\s=p\s+.1
If p\s>4 Then p\s=4
If p\s<-4 Then p\s=-4
If p\strafe>0 Then p\strafe=p\strafe-.1
If p\strafe<0 Then p\strafe=p\strafe+.1
If p\strafe>3 Then p\strafe=3
If p\strafe<-3 Then p\strafe=-3
Next
End Function
Function UpdatePlayer()
For p.player=Each player
p\a=angledif(p\x,p\y,MouseX(),MouseY())
p\xv=-(Sin(p\a)*p\s)
p\yv=-(Cos(p\a)*p\s)
p\xv=p\xv-(Sin(p\a+90)*p\strafe)
p\yv=p\yv-(Cos(p\a+90)*p\strafe)
p\x=p\x+p\xv
p\y=p\y+p\yv
drawship(p\x,p\y,p\a)
Next
End Function
Function DrawShip(x,y,ang)
Local x1=x-(Sin(ang)*8)
Local y1=y-(Cos(ang)*8)
Local x2=x-(Sin(ang+140)*6)
Local y2=y-(Cos(ang+140)*6)
Local x3=x-(Sin(ang-140)*6)
Local y3=y-(Cos(ang-140)*6)
Line x1,y1,x2,y2
Line x2,y2,x3,y3
Line x3,y3,x1,y1
End Function
Function angledif#(x1,y1,x2,y2) ; x2 y2 naar
Local angle = 0
Local lowest = 1024
For i=0 To 360
x3 = x1-Sin(angle) * 211
y3 = y1-Cos(angle) * 211
angle = angle + 1
NewA = Sqr((x3-x2)^2+(y3-y2)^2)
If NewA < lowest Then lowest = NewA : uitgraad = i
Next
Return uitgraad
End Function
I pulled AngleDif#() out of the code archives a while ago, not sure who posted it though sry. (oh yeah, if some1 could tell me what uitgraad and naar mean so i can put the rest of it into english that would be nice)