Thanks dreamora
Strict
Graphics 800,600,32,60
Const CTE_FPS = 60
Global Liste_boulets : TList = CreateList()
Type TBoulet
Field x#
Field y#
Field CentreX
Field CentreY
Field Rayon
Field angle
Field Vitesse#
Function Creer:TBoulet(x:Int, y:Int, Rayon:Int, Vitesse:Float)
Local b:Tboulet = New TBoulet
b.CentreX = x
b.CentreY = y
b.Rayon = Rayon
b.Angle = 0
b.Vitesse = Vitesse
ListAddLast Liste_boulets, b
Return b
End Function
Method Maj()
Angle = Angle + Vitesse#*360.0/CTE_FPS
x# = Cos(Angle) * Rayon
y# = Sin(Angle) * Rayon
SetColor 0,0,255
SetLineWidth 4
DrawLine CentreX, CentreY, CentreX + x, CentreY + y
SetColor 255,0,0
DrawOval CentreX + x-20,CentreY + y-20,40,40
End Method
End Type
Local b1:TBoulet = TBoulet.Creer (GraphicsWidth()/2, GraphicsHeight()/2, 200, 0.25)
Local b2:TBoulet = TBoulet.Creer (GraphicsWidth()/2-100, GraphicsHeight()/2+100, 100, -0.40)
While Not KeyDown(KEY_ESCAPE)
Cls
b1.Maj()
b2.Maj()
Flip
Wend
|