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 / Delete text question

Author
Message
RisTar_sn
19
Years of Service
User Offline
Joined: 15th Jan 2005
Location:
Posted: 17th Feb 2006 17:43
Hi , im creating a little game called circle casino
well im just in the intro screen now .
ive created a bunch of circles poping up on the screen and put
the title using text command . what i want to do now is put a
PRESS ANY KEY text , and i want it to flicker like 1 sec u see it
and 1 sec u dont , ive put it in a loop but i dont know how to delete the text from the screen at the end of the loop ,
I hope that u can understand what is my prob . sorry for any bad ENG

Here is the code so far
RisTar_sn
19
Years of Service
User Offline
Joined: 15th Jan 2005
Location:
Posted: 17th Feb 2006 17:47
O , and another question , .. whenever i call the cicrcle_intro function with a value of RND(640),RND(480),RND(20) The program crash out after it draws a few circles on the screen , any 1 have any idea why ?
The Nerd
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 17th Feb 2006 18:04 Edited at: 17th Feb 2006 18:05
Now about the delete text question... Do you want to clear the whole screen or only the text? To clear the whole screen use the command


Oh, and a little advice In your code, normally you don't have more than one main loop(DO LOOP). So you could do like this:



Now I've changed the code so you use a "REPEAT-UNTIL" loop. If you have questions about this type of loop, just ask

Quote: "O , and another question , .. whenever i call the cicrcle_intro function with a value of RND(640),RND(480),RND(20) The program crash out"


Maybe it's because that your color values are way to big... The maximum value for a color code is "255". So something like 640 and 480 exceeds that limit.

-The Nerd

Free Particle Engine for DarkBasic Pro:
http://forum.thegamecreators.com/?m=forum_view&t=60141&b=5
RisTar_sn
19
Years of Service
User Offline
Joined: 15th Jan 2005
Location:
Posted: 17th Feb 2006 18:25
i want to only clear the text not the screen .
about the loop , why is it bad to use the same do loop twice ?
and thanks for the color values problem
The Nerd
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 17th Feb 2006 18:42
Quote: "about the loop , why is it bad to use the same do loop twice ?"


Well it's not because it's so bad to do... I just don't use it... Besides as you can see, I made your code 1 line shorter( ) because I used the repeat-until loop.

-The Nerd

Free Particle Engine for DarkBasic Pro:
http://forum.thegamecreators.com/?m=forum_view&t=60141&b=5
x1bwork
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 17th Feb 2006 18:47 Edited at: 17th Feb 2006 18:52
Quote: "I made your code 1 line shorter"


What Nerd is trying to tell you,is that efficient coding gets the task done in minimal amount of code and system resource consumption.

Its nothing now,but when you start writing thousands lines of code for a project,you want it as resource friendly as possible.

For this very same reason do we make it a habit to "clean up" on exit or changing of a screen,etc. Give back the resources(ram) consumed when its no longer needed to use it. aka "Clean Exit"

Check out stuff such as "Delete Image", "Delete Sound", "Flush Video Memory" etc.

It's good form to get into now while you're still writing small programs.

While im ranting,you will want to learn about "memory leaks" and how to identify and avoid them.

RisTar_sn
19
Years of Service
User Offline
Joined: 15th Jan 2005
Location:
Posted: 17th Feb 2006 19:28
OK got it . but can any1 help me with the press any key text ??
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 17th Feb 2006 21:21 Edited at: 17th Feb 2006 21:45
You can make it a sprite and use a timer to turn it on/off. The following code snip is made for Classic (in Pro you would have to replace the background).




RisTar_sn
19
Years of Service
User Offline
Joined: 15th Jan 2005
Location:
Posted: 19th Feb 2006 22:15
Actually its not working , i dont know why , but if its about sprites i think that ill wait . im learning from the begginers guide so when ill get to the 2D chapter ill work something out
But thanks anyway guys
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Feb 2006 23:25
That code snip works for me in both Classic and Pro... well you can always use "set text opaque" and "print" spaces.


Login to post a reply

Server time is: 2024-09-24 17:28:15
Your offset time is: 2024-09-24 17:28:15