'// Rotate GL v.02 \\
'// By John Onyon a.k.a Unseen Machine \\
CHDIR "Unseen Demos\Rotate\" '/////////////////////////////////////////////////////////////////////////////////
'/////////////////////////////////////////////////////////////////////////////////
DIM SHARED Mouse
(1) AS MouseState
, Kb
(1) AS KeyBoardState
'// For Input capture DIM SHARED CamVec
AS VECTOR_GL
, RadHelp#
, Init_GL
, Allow_GL
AS _BYTE '// For Camera, Movement and GL initialisation
'// Initial Setup \\
_FPS 30 ' // Set maximium frames per second
'// Allow SUB _GL and initialise it \\
Init_GL = True
Allow_GL = True
GDK_Keyboard_GetState Kb(0)
Left = True
IsRotating = True
Left = False
IsRotating = True
Rotation = Rotation - 2
Rotation = 0
IsRotating = False
RotateArray
Rotation = Rotation + 2
Rotation = 0
IsRotating = False
RotateArray
RotateArray
RotateArray
IF GT#
- DropTimer#
>= .05 THEN
IF Level
(i%
, j%
) = 3 THEN '// Player ball Level(i%, j%) = 0
Level(i%, j% + 1) = 3
Ball_IsFalling = True
ELSEIF Level
(i%
, j%
+ 1) = 2 THEN '// Hit target square IF CurrentLevel
< LevelMax
THEN LoadLevel
CurrentLevel = CurrentLevel + 1
Ball_IsFalling = False
Level(i%, j%) = 0
Level(i%, j% + 1) = 4
IF Level
(i%
, j%
+ 1) = 3 THEN '// gonna crush the ball!!!!
'// Do a loose a life thingy
'// Restart the level
Level(i2%, j2%) = LvlBckUp(i2%, j2%)
Ball_IsFalling = False
SkipLoops:
DropTimer# = GT#
Kb(1) = Kb(0)
'###############################################################################################################################
LvlData:
DATA 0,0,0,0,0,0,0,0,1,1,1,1 DATA 0,1,1,1,1,1,1,1,1,0,0,1 DATA 0,1,0,0,0,0,1,0,0,0,0,1 DATA 0,1,0,0,0,0,0,0,0,0,1,1 DATA 0,1,1,0,1,0,1,1,0,1,1,0 DATA 0,0,1,0,1,2,1,1,0,1,0,0 DATA 0,0,1,0,1,1,1,1,0,1,0,0 DATA 0,0,1,0,1,0,0,1,3,1,0,0 DATA 0,0,1,4,1,0,0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,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0
'###################################################################################################################################
_glClearColor 0, 0, 0, 1 '// Set background (clear) color to black _glEnable _GL_DEPTH_TEST
' // Enables depth buffer for hidden surface removal
'// Setup a perspective view
_gluPerspective 80, 800 / 600, 1, 400 '// Field of view, Aspect ratio, near depth, far depth
'// Load models, terrain and other bits here
LevelBlock = GDK_GL_LOAD_TEXTURE("Block.PNG")
BallTexture = GDK_GL_LOAD_TEXTURE("Ball.PNG")
TargetTexture = GDK_GL_LOAD_TEXTURE("Target.PNG")
Enemyblock = GDK_GL_LOAD_TEXTURE("YellowBlock.png")
'// Load level data
LoadLevel
CurrentLevel = 1
LevelMax = 6
'// Switch to rendering mode
Init_GL = False
x% = -60
y% = 60
z% = -100
'// Clear the depth buffer and reset the view matrix (effectively CLS)
GDK_GL_CLS
EnemyCount = 0
x% = -60
GDK_GL_SET_TEXTURE LevelBlock
GDK_GL_CUBE x%, y%, z%, 10
GDK_GL_SET_TEXTURE TargetTexture
GDK_GL_CUBE x%, y%, z%, 10
GDK_GL_SET_TEXTURE BallTexture
GDK_GL_SPHERE 5, 16, 16, -1
GDK_GL_SET_TEXTURE Enemyblock
GDK_GL_CUBE x%, y%, z%, 10
x% = x% + 10
y% = y% - 10
'###################################################################################################################################
'// library inclusions
'###################################################################################################################################
CopyArray(X%, Y%) = Level(X%, Y%)
Level(11 - Y%, X%) = CopyArray(X%, Y%)
'###################################################################################################################################
Level(i%, j%) = LevelBit%
LvlBckUp(i%, j%) = LevelBit%
'###################################################################################################################################