Code archives/3D Graphics - Misc/Spinning platforms
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
Here's a simple example of how you can do spinning platforms for 3D platform games like Mario or Jakk and Daxter. | |||||
; ; Spinning platform example ; Graphics3D 800, 600 light = CreateLight() camera = CreateCamera() PositionEntity camera, 0, 2, -10 ball = CreateSphere() PositionEntity ball, 4, 5, 0 table = CreateCube() ScaleEntity table, 8, 0.1, 8 EntityPickMode table, 2 ; Make table pickable yv# = 0 Repeat ; ; Do the line pick ; x# = EntityX(ball) y# = EntityY(ball) z# = EntityZ(ball) lp = LinePick(x, y, z, 0, -1.1, 0) ; ; Check if table is directly under the ball ; If lp = 0 Then yv = yv - 0.01 ElseIf yv < 0 Then PositionEntity ball, PickedX(), PickedY()+1, PickedZ() yv = 0 End If ; ; Hit space to jump ; If KeyHit(57) Then yv = 0.5 ; ; Move ball ; TranslateEntity ball, 0, yv, 0 ; ; Parent entity to whatever is picked ; EntityParent ball, lp ; ; Turn the table ; TurnEntity table, 0, 2, 0 ; ; Reparent ball back to main world ; EntityParent ball, 0 RenderWorld Flip Until KeyHit(1) |
Comments
None.
Code Archives Forum