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 / DB Pro make flashing text

Author
Message
Jaded Gamer
18
Years of Service
User Offline
Joined: 19th Apr 2006
Location: Iceland
Posted: 7th Jun 2006 00:48
Actually I have three burning questions, but the first one involves the best way to make a flashing text appear on the screen, waiting for a keypress, (ie when the program is paused). I have tried a few ways to do this, but I know it can be done better, I just can't figure out how. Can someone please show me the best way?



<hopes the code will show up and wishes there was a preview function for the message>.

My second question is can someone please show me how to do the same thing in 3d? What needs to be done differently?

My third question is concerning functions. I have read a lot on the forums, but I am a bit confused about the difference between a function and a subroutine (gosub-return), not in how they are called but in what their use would be. Can someone please explain to me the difference, and maybe give an example of when a function would be better to use than a subroutine?
Crit
18
Years of Service
User Offline
Joined: 24th May 2006
Location:
Posted: 7th Jun 2006 17:45
My suggestion is to use functions always. You can pass variables to functions and they can return a value. Also, functions have their own local variable space, so you don't have to worry about having millions of global variables and coming up with unique variable names.

I don't have dbp on this computer, but it looks like that code won't work. Instead of printing "<< >>" to the screen, it seems like you should be redrawing the screen. In 3D you could just use the sync command. In 2D you could use cls to make the screen black, or paste image to put a picture on the screen.

Jaded Gamer
18
Years of Service
User Offline
Joined: 19th Apr 2006
Location: Iceland
Posted: 7th Jun 2006 19:50
Thank you for responding, and for giving some clarification on the use of functions. It is much appreciated.

The code I had included does work as intended in 2d, I was just hoping to learn a better way to achieve the same effect, which is to flash << Game Paused >> near the bottom of the screen while the program was paused.

I didn't want to clear the entire screen because I wanted to use this to pause a page to allow someone to read, or to be able to pause a game in action, etc. without making the screen go blank.

I realize I could also just use wait key, but then I wouldn't have the retro effect I was going for.
Dream And Death
18
Years of Service
User Offline
Joined: 21st Feb 2006
Location: The circus! Juggling job, kids and DBPro
Posted: 7th Jun 2006 20:41
Try making a sprite of your <<< Game Paused >>> and one of your <<< >>> text. Assuming these sprites are 1 and 2.

Then do something like:

Adjust the 500 for faster or slower flashing
Jaded Gamer
18
Years of Service
User Offline
Joined: 19th Apr 2006
Location: Iceland
Posted: 7th Jun 2006 21:17
Thank you kindly for your response and suggestion. It looks like a good place to start.
Moe
18
Years of Service
User Offline
Joined: 1st Apr 2006
Location: Sunny California
Posted: 8th Jun 2006 03:40
a function would be

that would create object 3 size 50, and delete it after 2 seconds, but after pie you can put any variable. that code doesnt work bcuz the if function isnt in a loop, but whatever.
A gosub

A function is more like a custom command, a gosub is a subtask. You could switch the jobs, but if ur using it alot of times, with changing variables then u want a function, otherwise subroutine. Ive never been good @ explaining stuff so sorry if i make absolutely no sense

parrot
Euphoria
18
Years of Service
User Offline
Joined: 21st Feb 2006
Location: United Kingdom
Posted: 9th Jun 2006 15:01
Expanding on Dream And Deaths idea you could create an animated sprite, with alternating frames of "<< >>" & "<< Game Paused >>" using CREATE ANIMATED SPRITE

Then just issue a PLAY SPRITE with a delay value for the time between flashes.
Jaded Gamer
18
Years of Service
User Offline
Joined: 19th Apr 2006
Location: Iceland
Posted: 9th Jun 2006 20:48
Thank you all for your responses and help

I feel a lot more confident just knowing there is such great support here!
Jaded Gamer
18
Years of Service
User Offline
Joined: 19th Apr 2006
Location: Iceland
Posted: 15th Jun 2006 01:01
Another quick question concerning text, without starting another thread...

would this line:

mystring$=left$(mystring$,4)

be valid in DB Pro if the length of mystring$ was less than 4?
Crit
18
Years of Service
User Offline
Joined: 24th May 2006
Location:
Posted: 15th Jun 2006 15:23
They recently changed how left$, mid$, and right$ work. I'm pretty sure that would work though.

The only way to know for sure is to try it out:

That code should print

hi
2

Jaded Gamer
18
Years of Service
User Offline
Joined: 19th Apr 2006
Location: Iceland
Posted: 15th Jun 2006 18:01
Thank you again, Crit! That does indeed work.
Mr X
18
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 15th Jun 2006 19:08 Edited at: 15th Jun 2006 19:22
I got an idea about how to make a flashing text when I read the part about the strings, and it doesnt use sprites at all. Simply print out a string on the screen that you change after a cirtain time.



EDIT:

Made a function out of it.

Login to post a reply

Server time is: 2024-09-25 01:34:03
Your offset time is: 2024-09-25 01:34:03