Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / i need help

Author
Message
freiza
21
Years of Service
User Offline
Joined: 22nd Jul 2003
Location:
Posted: 26th Jul 2003 21:37
i got this code ok and every time i complie it than execute it it comes up with a error i use dba can some 1 help this is the code:

rem setup sync
sync on
sync rate 30
rem create 10 cubes and place randomly
for x = 1 to 10
make object cube x,100
position object x,rnd(2000),0,rnd(2000)
next x
rem make sphere
make object sphere 10,50
rem main loop
do
rem store object angle Y in aY#
aY# = object angle Y(10)
rem control input for camera
if upkey()=1 then move object 10,10
if leftkey()=1 then yrotate object 10,wrapvalue(caY#-5)
if rightkey()=1 then yrotate object 10,wrapvalue(caY#+5)
if downkey()=1 then move object -10,10
rem get player object postion and store in x# and z#
x# = object position x(10)
z# = object position z(10)
rem get new camera position and store in cz# and cx#
cz# = newzvalue(z#,aY#-180,100)
cx# = newxvalue(x#,aY#-180,100)
rem position camera
position camera cx#,100,cz#
rem point the camera at the player object
point camera x#,50,z#
rem refresh screen
sync
loop
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 26th Jul 2003 21:42
See amended code below.

1. You created 10 random objects 1-10 and then tried to create a player object 10. You can't have two objects with same number. Either do as I did and only create 9, or change player object to a higher number.

2.
changed two occurences of caY to aY



The programmer formerly known as sonic

Login to post a reply

Server time is: 2024-09-20 17:50:20
Your offset time is: 2024-09-20 17:50:20