HI!
I made a hive. I don't finished yet, because there are some mistakes in the program
Rem Project: hive
Rem Made by: adamika2000
Rem **** Main Source File ****
set display mode 1024, 768, 32
type beeop
age as integer
work as integer
`work: 0:nothing 1:scout 2:on the way 3:go home
target as integer
cx as boolean
ktv as integer
fok as float
cp as integer
endtype
dim pollen(30)
dim bees(0) as beeop
targetflower as integer
beenum as integer
scoutnum as integer
pollens as integer
gametime as integer
time=timer()
stime as integer = time
gyart as integer
sync on
sync rate 60
backdrop on
color backdrop rgb(128,255,255)
Make Matrix 1,8000,8000,1,1
Create Bitmap 1,128,128
CLS RGB(0,128,0)
Get Image 1,0,0,128,128
Set Current Bitmap 0
Delete Bitmap 1
Prepare Matrix Texture 1,1,1,1
Position Matrix 1,-4000,0,-4000
`tree
make object cylinder 1,10
scale object 1, 100,600,100
color object 1,rgb(150,70,0)
position object 1,0,30,0
make object sphere 2,40
color object 2,rgb(20,140,20)
position object 2,0,70,0
make object box 3,0.3,0.3,10
color object 3,rgb(150,70,0)
position object 3,7,66,-15
`hive
make object sphere 4,5
color object 4,rgb(200,200,23)
scale object 4,100,150,100
position object 4,7,63,-20
`flowers
randomize timer()
for fi = 1 to 30
pollen(fi) = 15 + rnd(5)
fx# = (fi * 3) + 2
posx# = rnd(1000)-500
posz# = rnd(1000)-500
make object box fx#, 0.3,10,0.3
position object fx#,posx#,5,posz#
color object fx#,rgb(20,140,20)
fx# = fx# + 1
make object sphere fx#,1
scale object fx#,500,100,500
position object fx#,posx#,10,posz#
fx# = fx# + 1
make object sphere fx#,2
color object fx#,rgb(255,255,0)
position object fx#,posx#,10,posz#
next fi
`Bee
make object sphere 100,0.2
scale object 100,100,100,160
color object 100, rgb(220,220,0)
position object 100,7,63,-20
`camera
do
position camera -8.7,67.5,-38.5
point camera object position x(100),object position y(100),object position z(100)
center text screen width()/2,screen height()/2,"Press space to start!"
if spacekey() = 1 then goto megy
sync
loop
megy:
do
time=timer()
gameTime=stime - time
gyart = abs(gametime)
`bees
if beenum = 0
beenum = 1
make object sphere 101,0.2
scale object 101,100,100,160
color object 101, rgb(220,220,0)
position object 101,7,63,-20
array insert at bottom bees()
position camera -8.7,67.5,-38.5
point camera object position x(101),object position y(101),object position z(101)
endif
if pollens = 5
pollens = 0
beenum = beenum + 1
make object sphere 100 + beenum,0.2
scale object 100 + beenum,100,100,160
color object 100 + beenum, rgb(220,220,0)
position object 100 + beenum,7,63,-20
array insert at bottom bees()
endif
if targetflower = 0 and scoutnum = 0
for bn = 1 to beenum
if bees(bn).work = 0
bees(bn).work = 1
point object bn + 100,-12,15,0
scoutnum = scoutnum + 1
goto forend
endif
next bn
endif
forend:
for bx = 1 to beenum
if bees(bx).work = 1
if bees(bx).cx = 0
move object bx + 100,0.1
if object position x(bx + 100) < -12 and object position y(bx + 100) < 15
bees(bx).cx = 1
Xrotate Object bx + 100,0
Yrotate Object bx + 100,0
Zrotate Object bx + 100,0
bees(bx).ktv = 1
endif
else
move object bx + 100,0.126
Yrotate Object bx + 100,Wrapvalue(Object Angle Y(bx + 100)+0.1/bees(bx).ktv)
bees(bx).fok = bees(bx).fok+0.1/bees(bx).ktv
if bees(bx).fok > 500
bees(bx).fok = 0
bees(bx).ktv = bees(bx).ktv + 1
endif
for bi = 1 to 30
fx# = (bi * 3) + 2
if (abs(object position x(bx + 100) - object position x(fx#))^2 + abs(object position z(bx + 100) - object position z(fx#))^2)^0.5 < 75
if pollen(bi) > 0
bees(bx).work = 2
point object bx + 100,object position x(fx#+2),object position y(fx#+2),object position z(fx#+2)
bees(bx).target = bi
targetflower = bi
scoutnum = scoutnum + 1
endif
endif
next bi
endif
endif
if bees(bx).work = 3
move object bx + 100,0.1
if abs(object position x(bx + 100) - 7) < 1 and abs(object position y(bx + 100) - 63) < 1 and abs(object position z(bx + 100) + 20) < 1
bees(bx).work = 0
pollens = pollens + bees(bx).cp
bees(bx).cp = 0
endif
endif
if targetflower > 0
fx# = (targetflower * 3) + 4
for ba = 1 to beenum
if bees(ba).work = 0
if gyart > 1000
gyart = 0
point object ba + 100,object position x(fx#),object position y(fx#),object position z(fx#)
bees(ba).work = 2
endif
endif
if bees(ba).work = 2
move object ba+100,0.1
endif
fx# = (bees(ba).target * 3) + 4
if abs(object position x(ba + 100) - object position x(fx#)) < 1 and abs(object position y(ba + 100) - object position y(fx#)) < 1 and abs(object position z(ba + 100) - object position z(fx#)) < 1
if pollen(bees(ba).target) = 0
color object (bees(ba).target * 3) + 4,rgb(200,200,200)
point object ba + 100,7,63,-20
bees(ba).work = 3
targetflower = 0
else
bees(ba).cp = 1
point object ba + 100,7,63,-20
bees(ba).work = 3
endif
endif
next ba
endif
next bx
`bee end
`camera
camera_c()
`texts
ShowRet=Pick Object(Object Screen X(3),Object Screen Y(3),3,3)>0
If ShowRet>0
center text object screen x(4),object screen y(4),"Hive"
endif
text 0,0,"Pollens in the hive: " + str$(pollens)
text 0,15,"Num of bees: " + str$(beenum)
text 0,30,"Move camera: arrowkeys + 'A' and 'D' keys, + control, shift"
text 0,45,"Follow the bee: key 'F'"
if beop(0).work = 1 then
center text screen width()/2,screen height()/2, "Searching for flowers"
end if
if beop(0).work = 2 then
center text screen width()/2,screen height()/2, "Fly to the flower"
end if
if beop(0).work = 3 then
center text screen width()/2,screen height()/2, "Fly home"
end if
sync
loop
function camera_c()
if downkey() = 1
pitch camera down 1
endif
if upkey() = 1
pitch camera up 1
endif
if leftkey() = 1
turn camera left 1
endif
if rightkey() = 1
turn camera right 1
endif
if inkey$() = "a"
roll camera left 1
endif
if inkey$() = "d"
roll camera right 1
endif
if controlkey() = 1
move camera 0.15
endif
if shiftkey() = 1
move camera -0.1
endif
if camera position y(0) < 1
position camera 0, camera position x(0),1,camera position z(0)
endif
if inkey$() = "f"
xrotate camera Wrapvalue(Object Angle x(101))
Yrotate camera Wrapvalue(Object Angle Y(101))
zrotate camera Wrapvalue(Object Angle z(101))
position camera object position x(101),object position y(101),object position z(101)
pitch camera down 12
move camera -10
endif
`print str$(camera position x(0)) + ":" + str$(camera position y(0)) + ":" + str$(camera position z(0))
endfunction