This is my first post on the forum, so I hope I'm doing this right.
I'm working on the "CarbonAde" project for a class, and I'm getting some very weird bugs in my game.
NOTE: I'm using the carbonade can generation code from the example given with the ISL training program
The plan for my game is simple: you roll down a road, switching between two lanes, collecting fruit and dodging cars as you go.
At first the only problem I had was that the lid on the carbonade can wouldn't appear(I got past that by positioning the camera so you couldn't see it)
Now, whenever it gets to the object generation on line 86,
the can is moved to X:0(it should never be there during the game, with the exception of lane changes),
and the background plane appears to vanish.
CODE:
sync rate 60
Load image "C:\Program Files\The Game Creators\Dark Basic Professional Online\Projects\MyProj\ISL\Carbonade\images/CarbonAde-can_label.bmp",1
Load image "C:\Program Files\The Game Creators\Dark Basic Professional Online\Projects\MyProj\ISL\Carbonade\images\CarbonAde-can_lid.bmp",2
Load image "F:\SCHOOL\GAMEDESIGN\games\CARBONADE_FINAL\resources\roadf.bmp",3:REM the background road image(not needed) - remove it if it causes any problems
tf_c = 0
tf_out = 0
bl = 1
g_clane=2
g_chtolane=0
g_icount = 10
g_l1t = 0
g_l2t = 0
dim ld$(19)
ld_count = 0
for ld_count = 0 to 19
ld$(ld_count) = ""
next ld_count
REM unfinished leaderboard
LEADERBOARD:
cls 0:backdrop off
ld_count = 0
for ld_count = 0 to 19
print str$(bl);". ";ld$(ld_count);" ---- ";ld$(ld_count+1)
ld_count = ld_count + 1
bl = bl + 1
next ld_count
wait key
GAMESEC:
cls 0
backdrop on
position camera 0,0,0
rotate camera 0,0,0
rem create CA can
make object cylinder 1,50
scale object 1,100,140,100
position object 1,0,-100,0
make object collision box 1,-25,-35,-25,25,35,25,0
make object sphere 2,50
Scale object 2, 100,0,90 :REM position can HERE
xrotate Object 2,90
yrotate object 2,30
zrotate object 2,0
make mesh from object 1,2
delete object 2
add limb 1,1,1
link limb 1,0,1
offset limb 1,1,-1,25,-8
scale limb 1,1,98,0,75
texture object 1,1
texture limb 1,1,2
rem water/floor
make object plane 2,2200,2100
texture object 2,3
position object 2,camera position X(),camera position Y(),camera position Z()+1000
rotate object 1,0,90,90
position camera 200,camera position y(),camera position z()
g_l1t = 120
g_l2t = 120
do
center text 200,300,str$(camera position X())
bl = wrapvalue(object angle y(1)-12)
g_l1t = g_l1t+1
g_l2t = g_l2t+1
tf_c = tf_c + 1
rotate object 1,0,bl,90
tf_out = time_update(tf_c,30)
center text 325,350,str$(tf_out)+"%"
scroll object texture 2,0,-0.01
position object 1,camera position X(),camera position Y()-500,camera position Z()+900
REM move to lane 1
if leftkey()=1 and g_clane = 2 then g_chtolane = 1
if g_chtolane = 1 then position camera camera position x()-20,camera position y(),camera position z()
if g_chtolane = 1 and camera position X()<-190 then g_chtolane=0:g_clane=1
REM move to lane 2
if rightkey()=1 and g_clane = 1 then g_chtolane = 2
if g_chtolane = 2 then position camera camera position x()+20,camera position y(),camera position z()
if g_chtolane = 2 and camera position X()>190 then g_chtolane=0:g_clane=2
REM create lane 1 objects
if rnd(30)=1 and lanetimer(g_l1t)>0.7
g_icount = 10
for g_icount = 10 to 19
if object exist(g_icount) <>1
g_l1t = 0
make object cube g_icount,75:REM the buggy line
position object g_icount,-200,1000,900
g_icount = 20
endif
next g_icount
endif
REM move lane 1 objects
g_icount = 10
for g_icount = 10 to 19
if object exist(g_icount) = 1
position object g_icount,object position x(g_icount),object position y(g_icount)-10,object position z(g_icount)
if object position y(g_icount)<-1000 then delete object g_icount
endif
next g_icount
loop
end
rem FUNCTION DECLARATION
function time_update(tf_c,tf_pof)
tf_s# =(tf_c/60)+1
tf_s2 = (tf_s#/tf_pof)*100
endfunction tf_s2
function lanetimer(lanet#)
lanet#=(lanet#/60)+1
endfunction lanet#
function ld_update(nname,nscore,cl)
endfunction
NOTE: I know that this program isn't very well written. I'll fix that once I get it to work
If you can know what I did wrong, please tell me. I'd really appreciate it.