lol, thanks TDK. I've never thought twice about using the goto command, but I read through you're tutorial, and I'm glad you steered me in the right direction. thanks!
I changed my program to use gosub. It doesn't have a the cool layout thing that you described in your tutorial, but at least it doesn't use the you-know-what command. haha. Now you got me scared to even talk about it!
`Instant replay example
`thanks for viewing
rem Preview
hide mouse : sync on : sync rate 60
rem controled object
make object cube 1,1
position object 1,2,1.51,5
yrotate object 1,90
color object 1,rgb(2000,10050,0)
rem walls and ground
make object box 2,1000,1,1000
make object box 3,1,20,40
position object 3,0,2,30
make object box 4,40,20,1
position object 4,20,2,0
make object box 5,1,20,40
position object 5,40,2,30
make object box 6,40,20,1
position object 6,20,2,50
make object box 7,20,20,1
position object 7,10,2,40
make object box 8,1,20,20
position object 8,20,2,30
make object box 9,1,20,20
position object 9,10,2,20
make object box 10,1,20,20
position object 10,20,2,30
make object box 11,20,20,1
position object 11,20,2,10
make object box 12,1,20,40
position object 12,30,2,20
for c = 2 to 100
if object exist (c) then color object c,RGB(255,255,255)
next c
make object box 1000,1,5,10
position object 1000,0,0,5
hide object 1000
make object box 1001,1,5,10
position object 1001,40,0,5
hide object 1001
rem sky
color backdrop 1000
rem collision
set object collision to boxes 2
rem set up replay values
global xreplay# as float
global zreplay# as float
global areplay# as float
dim xreplay#(10000)
dim zreplay#(10000)
dim areplay#(10000)
rem main loop
do
rem save current position for replay
xreplay#(r) = X1#
zreplay#(r) = Z1#
areplay#(r) = aY#
`screen text
set text size 10
text 10,10, "z position being saved as: " + str$(zreplay#(r))
text 10,30, "x position being saved as: " + str$(xreplay#(r))
text 10,50, "angle being saved as: " + str$(areplay#(r))
text 10,70, "saving all this data to frame: " + str$(r)
set text to bold : set text size 30 : center text 320,150,"Complete the Maze"
rem increase save frame
r = r + 1
rem controls
aY# = object angle Y(1)
if upkey()=1 then move object 1,0.4
if downkey()=1 then move object 1,-0.4
if rightkey()=1 then aY# = wrapvalue(aY#+3)
if leftkey()=1 then aY# = wrapvalue(aY#-3)
yrotate object 1,aY#
rem collision stats
if object collision(1,1001)
wait 1500
gosub replay
end
endif
if object collision(1,0) then position object 1,X1#,1.51,Z1#
rem camera
X1# = Object position x(1)
Z1# = Object position z(1)
X# = Newxvalue(X1#,aY#-180,5)
Z# = Newzvalue(Z1#,aY#-180,5)
Position Camera X#,4,Z#
Point camera X1#,3,Z1#
if controlkey()=1 then Position Camera X#,64,Z# : Point camera X1#,48,Z1#
rem end loop
sync
loop
replay:
r = 0
do
`play back what the player did in the maze
position object 1,xreplay#(r),1.51,zreplay#(r)
yrotate object 1,areplay#(r)
r = r + 1
`screen text
set text size 10
text 10,10, "z position being played back as: " + str$(zreplay#(r))
text 10,30, "x position being played back as: " + str$(xreplay#(r))
text 10,50, "angle being played back as: " + str$(areplay#(r))
text 10,70, "playing all this data for frame: " + str$(r)
set text to bold : set text size 30 : center text 320,150,"Instant Replay"
`reset replay
if zreplay#(r) = 0 and xreplay#(r) = 0 and areplay#(r) = 0 then r = 0
`replay camera
X# = Newxvalue(xreplay#(r),areplay#(r)-180,5)
Z# = Newzvalue(zreplay#(r),areplay#(r)-180,5)
Position Camera X#,4,Z#
Point camera xreplay#(r),3,zreplay#(r)
if controlkey()=1 then Position Camera X#,64,Z# : Point camera xreplay#(r),48,zreplay#(r)
`it's all over...
if returnkey()=1 then return
sync
loop
Have a nice day, God Bless You!
