arrays can be more than one dimension
u could have eggcarton(10,2)
arrays are global through functions if declared at the top in a global manner devoid of includes etc.
to go onto the next step and talk about TYPES>
` This source code was distributed via DBDN
` The Dark Basic Developer Network (http://dbdn.darkbasic.com)
` It is copyright David Smith and is used on DBDN with full permission
sync on
sync rate 0
set text size 20
set text font "verdana"
ink rgb(255,255,255),1
TYPE Monster
NUM AS INTEGER
NAME AS STRING
HPS AS INTEGER
x# as FLOAT
y# as FLOAT
z# as FLOAT
ENDTYPE
dim Monster(1) as Monster
Monster(1).NUM=1
Monster(1).NAME="BugBear"
Monster(1).HPS=35
Monster(1).x#=0.0
Monster(1).y#=0.0
Monster(1).z#=0.0
make object cube Monster(1).NUM,10
position object Monster(1).NUM,Monster(1).x#,Monster(1).y#,Monster(1).z#
position camera 0,30,-60
point camera 0,0,0
do
center text object screen x(1),object screen y(1),""+Monster(1).NAME
if escapekey()=1
delete object Monster(1).NUM
undim Monster(1)
end
endif
sync
loop
DB 1 has psuedo types in DARKEDIT, Guy.S. alternative editor.
it converts them to groups of arrays as DB doesnt have native TYPES.
The best thing to do is to work out exactly on paper how many objects u will actually need.
eg one monster object but also requires 5 bullet objects etc...
then study arrays and TYPES.