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 / Its just strange

Author
Message
Mr X
18
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 17th Apr 2006 13:06
Hi all.

Ive got a really strange problem. Or "problem" is propobly the wrong word, but its really strange. Take a look at this code:

This is the beginning of my new game. Whats starge is that I have to use the command "wait" before I sync the program, otherwise it wont show the text. I know I could do it like this:
, but I dont want to do it that way. So if anyone got an idea of whats "wrong", please tell me.
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 17th Apr 2006 15:07 Edited at: 17th Apr 2006 15:07
From what I can see it's not strange at all, it doesnt show the text because you dont have it i a loop so it will only display once and then close or do whatever's next in your code.



I dont see the problem with that.

Mr X
18
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 17th Apr 2006 16:11
Th "problem" is that this is the loading part where I load all the media for the game, so I havent put it in a loop. Besides, I thought you needed "cls" to clear the screen. But if its just that its not in a loop, why does it print out the text when I put in the command "wait"?
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 17th Apr 2006 16:23
If you're calling a cls or sync somewhere else in the game, then it will erase the text since its not inside a loop. The hole point of a loading screen is to provide some sort of status and a GUI for the user to see as their game loads, this would imply that the game takes a long time to load. The reason your text most likely isnt being displayed is because it only takes a few seconds to load all of the required media, so really the text is displayed but the media is loaded and the main loop initializes before you notice it.

Its either that, or you haven't set the backdrop off. The backdrop is the blue background that appears whenever you load/create any objects, so chances are you're loading your first model and the backdrop appears, clearing the screen. To stop this from happening, use the BACKDROP OFF command.

There's a work around for this; creating a "fake" loading bar, or using enough media to create a delay between the loading and runtime.

The fake loading screen IMO is completely useless and just an attempt at making your game look professional, when in essence professional games should be fast enough to load without a screen required in the beginning. Either way if you go this route you'll want to look into the Timer() command set to create random progress, search the forums and the code base for info'.

As always, entire source code instead of 3-4 lines always helps.

Mr X
18
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 17th Apr 2006 16:45 Edited at: 17th Apr 2006 16:45
Those 3-4 lines WAS my code. Im trying to recreate my first game, in a new version. The last version of it needed a loading screen, so I thought this one might need one to. Now my code is a few lines longer, but not much. And now Im not cirtain a loading screen will be needed (not as much media this time).

Quote: "Its either that, or you haven't set the backdrop off. The backdrop is the blue background that appears whenever you load/create any objects, so chances are you're loading your first model and the backdrop appears, clearing the screen. To stop this from happening, use the BACKDROP OFF command."


Its a 2d game, so that wont be needed.

Thanks for the help.
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 17th Apr 2006 16:53
Ah ok, well the TEXT command requires a constant sync. Use PRINT for the time being it'll save you the hassle.

spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 17th Apr 2006 16:56
In 2D games you sometimes need to double SYNC for the text to appear, usually first time you use it.



Boo!
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Apr 2006 17:13 Edited at: 17th Apr 2006 17:14
You can use a timer() loop.



And that will pause the game for all Hard Drives, and faster computers.

Mr X
18
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 17th Apr 2006 20:13
Quote: "Ah ok, well the TEXT command requires a constant sync. Use PRINT for the time being it'll save you the hassle."


Ok, didnt know that. I fixed that now, just had to make my own center text command.

Quote: "In 2D games you sometimes need to double SYNC for the text to appear, usually first time you use it.
"


Ive never run into that problem. Didnt know of it.

Quote: "You can use a timer() loop.

And that will pause the game for all Hard Drives, and faster computers."


Sorry to say it, but I dont understand what that has to do with anything. Could you explain it please?
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 18th Apr 2006 02:34
Well, you currently wait for a key press, that's no good.

Or you could wait 3000, that's no good either, because on a slow hard drive they will wait for the stuff to load, and then also wait for an extra 3 seconds.

My example only waits for 3 seconds on a really fast computer. On a slow computer, it doesn't wait at all, and just ignores the delay.

Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 18th Apr 2006 05:21
NOOOO

BAD BAD BAD

BAD IDEA!

LISTEN!



All you have to do is this:


Repeat
Load object 20blah
Load object blah24
Blah blah blah
Load object 45
Text 20,20,"Loading blah blah"
sync
until Object Exist(45)

See what I mean?

The last thing you do is load object 45
And so it will show the text while your objects load
And once object 45 is done loading
It will quit out of the loop!
And stop showing the text!

"Forgiveness is a good thing"
"Forgiveness is between them, and God. I set up the meeting"
-Man on Fire
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 18th Apr 2006 10:55
try it this way just added a sync in place of your wait 1 command.



I'm not getting you down am I, Ho Look! another fancy Door?
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 18th Apr 2006 11:05 Edited at: 18th Apr 2006 11:06
If these ideas are for a loading screen then you have to have some form of wait, otherwise the screen will just dissapear too quickly on some computers, but wait key is just overkill.

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 18th Apr 2006 13:57
No Xenocythe is right, using a while loop is probably the best route. Like I said the only reason for a loading bar is if youre media is large enough to require one, not just for your computer but for the average computer that will run your app. If its not needed dont make it.

Mr X
18
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 18th Apr 2006 14:11 Edited at: 18th Apr 2006 14:14
Pincho Paxton, I understand what you mean now. But the wait key part was just so the program wouldnt end, and Ive propobly removed it by now. Thanks for the help anyway.

Quote: "Repeat
Load object 20blah
Load object blah24
Blah blah blah
Load object 45
Text 20,20,"Loading blah blah"
sync
until Object Exist(45)"


I would have used a FOR-NEXT loop. But thats propobly that we have different ways to code, I wouldnt say that one way is better then another. But I think I wouldnt need that, though I havent so much media... for the moment, mayby there will be more in the future.

Quote: "try it this way just added a sync in place of your wait 1 command."


Never thought of that. But, as Ive allready said, I solved the disappering-loading-screen problem. All I had to do was to make an own center text command, then it worked (I thank RUCCUS for that, without his post about "text" and "print" I wouldnt have done it... I think).

Thanks all for your help.

EDIT:

Quote: "No Xenocythe is right, using a while loop is probably the best route. Like I said the only reason for a loading bar is if youre media is large enough to require one, not just for your computer but for the average computer that will run your app. If its not needed dont make it."


Thats why I (at the moment) doubt Ill need a loadingbar.
sub zero
18
Years of Service
User Offline
Joined: 14th Apr 2006
Location:
Posted: 22nd Apr 2006 13:35
hmm nope no I have no idea

Login to post a reply

Server time is: 2024-09-24 21:27:39
Your offset time is: 2024-09-24 21:27:39