bei ^ xs=x+20 und ys=y+0 und bei v xs=x+20 ys=y+40, aber was ist dann bei z.b 65°, oder bei 100° (außer, das dan wasser kocht
Achso, hier der Code:
Code: Alles auswählen
InitSprite()
InitSprite3D()
InitKeyboard()
OpenScreen(1024,768,16,"Test")
LoadSprite(1,"pfeil.bmp", #PB_Sprite_Texture)
LoadSprite(2,"kugel.bmp")
TransparentSpriteColor(1,255,0,255)
TransparentSpriteColor(2,255,0,255)
CreateSprite3D(1,1)
Sprite3DQuality(1)
Global x.w
Global y.w
Global trans.w
Global speed.w
Global plus.b
Global t.f
Global xs.w
Global ys.w
Global schies.b
Global g.f
g=-1 ;sonst fällt alles nach oben ^^
plus=1
speed=1
;---Anfang Code Template
; Drehen
Repeat
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left) : winkel - 1 : If winkel <= 0 : winkel = 360 : EndIf : EndIf
If KeyboardPushed(#PB_Key_Right) : winkel + 1 : If winkel >= 360 : winkel = 0 : EndIf : EndIf
; Vorwärts
If KeyboardPushed(#PB_Key_Up)
x=x + Cos(winkel *(2*3.1415/360)) * speed ; Grad zu Bogenmaß
y=y + Sin(winkel *(2*3.1415/360)) * speed
EndIf
; Rückwärts
If KeyboardPushed(#PB_Key_Down)
x=x + Cos(winkel *(2*3.1415/360)) * -speed
y=y + Sin(winkel *(2*3.1415/360)) * -speed
EndIf
;---Ende Code Template
If KeyboardReleased(#PB_Key_Add)
speed=speed+1
EndIf
If KeyboardReleased(#PB_Key_Subtract)
speed=speed-1
EndIf
If KeyboardReleased(#PB_Key_Space)
schies=1
t=0
xs=x+52
ys=y+17
EndIf
trans=trans+plus ; sieht cooler aus, find ich ;-)
If trans=255
plus=-1
EndIf
If trans=0
plus=1
EndIf
If schies=1
t=t+1
xs=xs+speed*t*Cos(winkel) ;Formeln aus dem Tafelwerk
ys=ys+(-g/2)*Pow(t,2)+speed*t*Sin(winkel)
DisplayTransparentSprite(2,xs,ys)
EndIf
Start3D()
DisplaySprite3D(1,x,y,trans)
RotateSprite3D(1,winkel,0)
Stop3D()
StartDrawing(ScreenOutput())
Locate(920,10)
DrawingMode(1)
FrontColor(255,255,255)
DrawText("Speed:"+Str(speed))
Locate(920,25)
DrawText(Str(winkel)+"°")
StopDrawing()
FlipBuffers()
ClearScreen(0,0,0)
Until KeyboardPushed(#PB_Key_Escape)
