Kleine Ballphysik (Verändert)
Übersicht

![]() |
BigmichiBetreff: Kleine Ballphysik (Verändert) |
![]() Antworten mit Zitat ![]() |
---|---|---|
so ich wollte ein kleines Game machen dafür ist es wichtige ein Ball we ein Flummi zu gestalten XD habs mal versucht und wollte mal fragen ob das so ok ist oder es optimierungsvorschläge gibt =)
Zur Änderung; man kann nun springen und zwar wenn der ball stil liegt oder die plate berührt das beschleunigt nochmal seine geschwindigkeit =) Code: [AUSKLAPPEN] Graphics3D 1024,768,16,2 SetBuffer BackBuffer() Global MP = CreatePivot() Global KLicht = CreateLight() Global Kamera = CreateCamera() PositionEntity Kamera,0,50,-50 PointEntity Kamera,MP EntityParent Klicht,Kamera Global Boden = CreateCube() ScaleEntity Boden,20,1,10 EntityColor Boden,255,0,0 EntityPickMode Boden,2 PositionEntity Boden,0,-10,0 EntityType Boden,2 Global Boden2 = CreateCube() ScaleEntity Boden2,20,1,10 EntityColor Boden2,255,0,0 EntityPickMode Boden2,2 PositionEntity Boden2,40,-30,0 EntityType Boden2,2 Global Ball = CreateSphere(16) PositionEntity Ball,0,30,0 EntityColor Ball,0,128,255 EntityRadius Ball,2,2 TurnEntity Ball,0,-90,0 EntityType Ball,1 Global Fall = 1 Global FSP# = 1 Global OFS#,OSS#,ZFS# Global SP = 1 Global OldY# Global ZZ While Not KeyHit(1) col = CountCollisions(Ball) If SP = 1 then If Col = 0 And Fall = -1 Then FSP = FSP + .05 MoveEntity Ball,0,-FSP,0 ElseIf Col <> 0 And Fall = -1 Fall = 1 OFS = FSP FSP = FSP - ((FSP /2)/2) MoveEntity Ball,0,FSP,0 ElseIf Fall = 1 Then FSP = FSP - .05 MoveEntity Ball,0,FSP,0 End if If FSP < 0 Then Fall = -1 : OSS = FSP ZFS = OSS +OFS End If If SP = 0 ;MoveEntity Ball,0,-1,0 If ZZ = 0 Then SP = 1 OldY = 0 End If oldY = EntityY(ball) End If ZZ = LinePick( EntityX(Ball), EntityY(Ball), EntityZ(Ball), EntityX(Ball) , EntityY(Ball) - 5, EntityZ(Ball),1 ) If ZFS < .2 And Oss <> 0 And Ofs <> 0 Then SP = 0 Oss = 0 Ofs = 0 YY# = EntityY(Ball) OldY = YY# End if ;If SP = 0 And FSP <> 0 Then SP = 1 If KeyHit(57) If SP = 0 Or ZZ <> 0 ;PositionEntity Ball,0,30,0 SP = 1 FSP = 1.8 ZFS = 1 Oss = 0 OFS = 0 Fall = 1 End if End if If Keydown(205) Then MoveEntity Ball,0,0,1 If Keydown(203) Then MoveEntity Ball,0,0,-1 Collisions 1,2,2,2 RenderWorld() UpdateWorld() Text 10,10,Col Text 10,30,FSP Text 10,50,ZFS Text 10,70,SP Text 10,90, ZZ If SP = 0 Then Text 10,130,"SPRUNG mit Leertaste" Flip : Cls Wend End |
||
![]() |
Bigmichi |
![]() Antworten mit Zitat ![]() |
---|---|---|
(verändert)
wäre echt mal praktisch wenn jemand was dazus agen würde XD |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group