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.

DarkBASIC Discussion / Help me please

Author
Message
Dax7
16
Years of Service
User Offline
Joined: 8th Jun 2008
Location:
Posted: 9th Jun 2008 04:49 Edited at: 10th Jun 2008 04:57
Everytime I try to execute this code it says "runtime error at line 42, object already exists" I am very new to Darkbasic, can anyone help? Also, if this is the wrong forum I am sorry.

Code:

Quote: "Rem Setup sync
Sync On
Sync Rate 30

Do

Rem Load Textures
Load Image "C:\Program Files\Dark Basic Software\Dark Basic\myproj\room\bmp\ball color.bmp",1

Rem Make sphere
Make object sphere 10,50
Texture object 10,1

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(aY#-5)
If Rightkey()=1 then Yrotate object 10,Wrapvalue(aY#+5)
If Downkey()=1 then Move object 10,-10

Rem get player object position 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,200)
cX# = Newxvalue(X#,aY#-180,200)

Rem position camera
Position Camera cX#,100,cZ#

Rem point the camera at the player object
Point camera X#,50,Z#

Rem Control input for camera
If Upkey()=1 then Move camera -1
If Downkey()=1 then Move camera 2

Sync
Loop"
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 9th Jun 2008 06:36 Edited at: 9th Jun 2008 06:38
First of all... use the code button, not quotes.
Anyways... the problem is that the code that makes the sphere is inside the loop... which gets repeated. So that means, it would make the same sphere over and over again in the loop. So that means you would have to move the texturing and everything else before the loop... like this:


Also, it's good to have a setup procedure, like this:


Your signature has been erased by a mod because it's larger than 600x120
Dax7
16
Years of Service
User Offline
Joined: 8th Jun 2008
Location:
Posted: 9th Jun 2008 16:10
Thank you sir, and I will remember to use code snippet next time
Dax7
16
Years of Service
User Offline
Joined: 8th Jun 2008
Location:
Posted: 9th Jun 2008 16:20 Edited at: 10th Jun 2008 04:56
Edit: sorry, didn't see that i already posted

Login to post a reply

Server time is: 2025-06-06 00:23:34
Your offset time is: 2025-06-06 00:23:34