home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
3D Game Programming for Teens (2nd Edition)
/
3DGPFT2E.iso
/
Source
/
Chapter13
/
demo13-10.bb
< prev
next >
Wrap
Text File
|
2009-01-20
|
1KB
|
67 lines
; demo13-10 - atoms and pausing
; -------------------
Graphics3D 640,480
SetBuffer BackBuffer()
Const P_KEY = 25
Const ESC_KEY = 1
light=CreateLight()
camera=CreateCamera()
PositionEntity camera, 0,0,-7
; Creating the nucleus.
nucleus=CreateSphere (16)
PositionEntity nucleus, 0,0,1
tex=LoadTexture( "sunskin.jpg" )
EntityTexture nucleus,tex
; Create a pivot for each orbit.
pivot=CreatePivot()
PositionEntity pivot,0,0,1
pivot2=CreatePivot()
PositionEntity pivot2, 0,0,1
pivot3=CreatePivot()
PositionEntity pivot3, 0,0,1
; Creating each orbit.
orbit=CreateSphere(16,pivot)
tex1=LoadTexture( "orbit.jpg" )
EntityTexture orbit, tex1
ScaleEntity orbit, 0.3,0.3,0.3
PositionEntity orbit,4,0,0
orbit2=CreateSphere(16,pivot2)
tex2=LoadTexture("orbit.jpg")
EntityTexture orbit2, tex1
ScaleEntity orbit2, 0.3,0.3,0.3
PositionEntity orbit2, 0,0,4
orbit3=CreateSphere(16,pivot3)
tex2=LoadTexture("orbit.jpg")
EntityTexture orbit3, tex1
ScaleEntity orbit3, 0.3,0.3,0.3
PositionEntity orbit3, 4,0,0
While Not KeyDown(ESC_KEY)
; Turn pivots, making atom orbit around the nucleus.
TurnEntity pivot,0,3,0
TurnEntity pivot2, 3,0,0
TurnEntity pivot3, 0,0,3
; Spinning the nucleus.
pitch#=pitch#+3 yaw#=yaw#+3 roll#=roll#+3
RotateEntity nucleus,pitch#,yaw#,roll#
RenderWorld
Flip
Wend
End