have a look at the whole code..
Gosub DataSetup
GoSub EnvironmentSetup
`Settings
plyr.speed=3
enemy(0,0).speed=0.5
Display_Boundary = true
Diagnostics = false
`create player object
plyr.id = NextObjID()
MakePlayerObj()
`create enemies
tid = NextObjID()
MakeEnemy(tid)
boundary.left = NextObjID()
boundary.right = boundary.left + 1
boundary.top = boundary.left + 2
boundary.bottom = boundary.left + 3
boundary.lose = boundary.left + 4
boundary.middle_shield = boundary.left + 5
boundary.left_shield = boundary.left + 6
boundary.right_shield = boundary.left + 7
MakeBndy(Display_Boundary)
do
'blank
sync
loop
`Environment.dba
DataSetup:
#Constant true 1
#Constant false 0
#Constant _blue 0 , 0 , 255
#Constant _red 255 ,0 , 0
#Constant _green 0, 255, 0
#Constant cyan 0, 255, 255
#Constant purple 223, 0, 255
#Constant gold 193, 160 , 4
#Constant yellow 255, 255, 0
#Constant violet 143, 0 , 255
Type Obj
id as byte
speed AS FLOAT
flag as byte
direction as boolean
bomb as integer
score as word
count as byte
lives as byte
Endtype
Type Collision
lose as integer
top as integer
bottom as integer
left as integer
right as integer
middle_shield as integer
left_shield as integer
right_shield as integer
Endtype
Global plyr as Obj
Global enemy as Obj
Global bullet as Obj
Global temp as Obj
Global bounbary as Collision
Global system as sys
Dim enemy(9,4) as Obj
system.wres = screen width()
system.hres = screen height()
Return
EnvironmentSetup:
Sync on
Sync rate 60
backdrop on
color backdrop 0
hide mouse
autocam off
randomize Timer()
Position Camera 0, 0, 300
Point Camera 0, 0, 0
Make Light 1
Position Light 1, 0, 0, 300
Return
`Functions.dba
Function NextObjID()
id = 0
state = false
Repeat
inc id
if Object Exist(id) = 0 then state = true
Until state = true
ENDFUNCTION id
Function MakePlayerObj()
Make object box plyr.id, 0.25, 0.15, 0.10
brush = NextObjID()
Make object box brush,0.05,0.05,0.10
position object brush, 0.10,0.05,0
Perform CSG Difference plyr.id, brush
position object brush, -0.10, 0.05 , 0
Perform CSG Difference plyr.id, brush
position object brush, 0,0.10,0
perform CSG union plyr.id, brush
delete object brush
position object plyr.id,0 ,-1,0
color object plyr.id,rgb(_red)
ENDFUNCTION
function MakeEnemy(obj)
for x = 0 to 9
for y = 0 to 4
enemy(x,y).flag = true
enemy(x,y).id = obj
make object box obj,0.10, 0.10 , 0.01
position object obj, 0.9-(x*0.2),0.9-(y*0.2),0
inc obj
select y
case 0
color object enemy(x, y).id , rgb(cyan)
endcase
case 1
color object enemy(x, y).id , rgb(violet)
endcase
case 2
color object enemy(x, y).id , rgb(_green)
endcase
case 3
color object enemy(x, y).id , rgb(yellow)
endcase
case 4
color object enemy(x, y).id , rgb(gold)
endcase
endselect
next y
next x
ENDFUNCTION
ENDFUNCTION
function MakeBndy(setboundary)
make object box boundary.left, 10, 350 , 10
position object boundary.left, 235, 0 , 0
Endfunction
i think i've messed up with variable 'boundary' or left,right...
kindly reply
Thanks..
Judgment Day Can Wait !!