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.

Author
Message
King Fluffs
15
Years of Service
User Offline
Joined: 28th Nov 2010
Location: Telford
Posted: 17th Jan 2011 19:47
I've recently begun making a program in dark basic.
Yesterday i saved my work them turned off the computer.
Today when i added more code to the program i clicked the run and compile button.

The program began running but just as the screen came up it disappeared again.

If anyone knows how to fix this then i thank you greatly.

Yes...i shall make games.
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 17th Jan 2011 20:53
Most likely it's because the program reached its end. Without a WAIT KEY or some kind of loop, when the program is done running, well, it ends.

If that's not the case, then posting your code will give everyone a chance to see what's going on.

King Fluffs
15
Years of Service
User Offline
Joined: 28th Nov 2010
Location: Telford
Posted: 17th Jan 2011 20:58
Sync On
Sync Rate 30
Rem Create sphere
Make object cube 1,100
Rem Main loop
Do
Rem Store the object's Y angle in aY#
aY# = Object angle Y(1)

Rem Control input
If Upkey()=1 then Move object 1,2
If Leftkey()=1 then aY# = Wrapvalue(aY#+5)
If Rightkey()=1 then aY# = Wrapvalue(aY#+5)

Rem rotate the sphere
Yrotate object 1,aY#

Rem Refresh Screen
Sync
LOOP
For x = 1 to 5
Make object cube x,100
Position object x,Rnd(2000),0,Rnd(2000)
NEXT
If Upkey()=1 then Move camera 10
If Leftkey()=1 then Yrotate Camera Wrapvalue(caY#-5)
If Rightkey()=1 then Yrotate Camera Wrapvalue (caY#-5)
Rem Setup sync
Sync On
Sync Rate 30

Rem Make Cubes and place randomly
For x = 1 to 5
Make object cube x,100
Position object x,Rnd(2000),0,Rnd(2000)
NEXT

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

Rem get player object position and store in X# and Z#
X# = Object position x(10)
Z# = Object position x(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

Rem Setup sync
Sync On
Sync Rate 30

Rem Make Cubes and place randomly
For x = 1 to 5
Make object sphere 10,50
Position object x,Rnd(2000),0,Rnd(2000)
Set object collision to boxes x
NEXT

Rem Make sphere
Make object sphere 10,50
Position object 10,-100,0,-100
Set object collision to spheres 10

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

Rem Detect collision
If Object collision(10,0)>0 then position object 10,X#,0,Z#

Rem get player object position and store in X# and Z#
X# = Object position x(10)
Z# = Object position x(10)

Rem get new camera position and store in cZ# and cX#
cZ# = Newsvalue(Z#,aY#-180,100)
cX# = Newsvalue(X#,aY#-180,100)

Rem position camera
Position camera cX#,75,cZ#

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

Rem Refresh Screen
Sync
LOOP

Yes...i shall make games.
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 17th Jan 2011 21:53 Edited at: 17th Jan 2011 22:12
Hmmm... you should really put the code in a code box.



Looking over your code now...

around line 103 and 104 you have


which are invalid commands. Replacing them with the valid z and x commands gives me a cube on the screen, and I can use the arrow keys to move or rotate. I don't see a sphere, or any kind of collision.

What happens when you change those two commands?

Further edit: Oh, I notice that your loop is before all the spheres and collision stuff, so never mind. I can see the cube just fine. Your post with the code looks like you have several versions all pasted into one program.

King Fluffs
15
Years of Service
User Offline
Joined: 28th Nov 2010
Location: Telford
Posted: 18th Jan 2011 17:56
Ah thanks, i was following the tutorial on this site about dark basic.

Ill make sure i use that code thingy next time.

Yes...i shall make games.

Login to post a reply

Server time is: 2026-07-18 02:08:57
Your offset time is: 2026-07-18 02:08:57