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 / Please help me get a typewriter effect for titles

Author
Message
kp1994
14
Years of Service
User Offline
Joined: 24th Mar 2010
Location:
Posted: 25th Mar 2010 01:56
Hi, I'm new to this forum, so I'm sorry if I break any rules or something.

I'm trying to make a title appear with a typewriter effect, and what I mean by that is have each letter of the title appear one at a time. Here is the code I tried to use:



What I tried to do was to first load the title screen (the splash template file). Then I'd set what kind of text it would be. After that, I put in some statements that would input the first letter of the title, have it wait 1000 units (or one second), then input the second letter, wait one second, etc.

The problem I'm having is whenever I test the game, all it does is show a black screen for about five to ten seconds, and then just show the title screen with all the letters in the title on it. Can anyone tell me why this keeps happening, what I'm doing wrong, and what to do to correctly have the typewriter effect I'm looking for?
Indicium
16
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 25th Mar 2010 16:03
Quote: "do
center text 145,175,"E"
loop"


This will just be looping over and over so the wait command is never actually executed.

Windows 7 32-Bit Home Premium Intel Pentium Dual-Core @ 1.46Ghz 2038mb RAM
Cs2009
14
Years of Service
User Offline
Joined: 28th Feb 2010
Location:
Posted: 25th Mar 2010 19:14
Try

If you use do and loop it will loop everything in-between do and loop.

Chris
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 25th Mar 2010 19:48 Edited at: 25th Mar 2010 20:03
What you are trying to do isn't overly difficult and simply involves using the Mid$() and Len() functions on the string you want to appear in a For..Next loop. A timer can be used to make sure the characters appear at the correct intervals.

A few minutes work when you know what you are doing. But, I feel that this is a little too advanced for you yet. Like I said in your other thread, you need to slow down and learn the basics first.

Programming is a skill which takes many weeks and months to learn and years to master. There are rules - very strict rules and if you don't know exactly what you are doing, nothing will ever work as you want it to. You simply can't make up what you don't know and expect it to work.

As I said, you really need to read some tutorials. You might find them long and boring, but unless you invest the time and effort into learning the basics, you will never ever write a fully functioning program in any language.

For example, do you know what Load Bitmap actually does?

Or why you used Ink RGB(0,0,0),0 rather than Ink 0,0?

Or what a Do...Loop is? If you knew that it was an 'unconditional loop', you wouldn't be wondering why program control never gets out of the first one - making the Wait 1000 (and every other line after it) totally redundant.

What is a Sync and where should it be used?

These are all questions you NEED to be able to answer before you start to write anything other than test programs of no more than a handful of lines.

Sorry, but it's obvious you don't know these things and are producing non-working programs.

But don't worry, as a newcomer to programming, you are allowed to do this.

No-one's going to tell you to give up, but if you really want to succeed you are going to have to take on board the advice you are given and put the time and effort in to learn all this elementary stuff. It's certainly not a five minute job!

Like I said, start with tutorials that start at your level and you'll soon pick it up. You could do far worse than those I pointed you to in your other thread.

Once you show you are at least making an effort to learn, people on here will be only too willing to help you out when you get stuck... or not read your posts if you ignore advice and continue doing your own thing!

TDK

Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 25th Mar 2010 21:05
As TKD pointed out you really need to look up tutorials at least get the BASICs down.

Anyhow here's a freebie.
Indicium
16
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 26th Mar 2010 02:07


It can be something as simple as that.

Windows 7 32-Bit Home Premium Intel Pentium Dual-Core @ 1.46Ghz 2038mb RAM
kp1994
14
Years of Service
User Offline
Joined: 24th Mar 2010
Location:
Posted: 26th Mar 2010 05:20
Thanks to everyone for their help.

Ashingda 27's code snippet gives the effect I want, but is there any way to make it a bit faster? It takes about 3 seconds between every letter.

To let you guys know, I AM a complete beginner. This game is for my Video Game Development class in my high school, and right now I'm designing an edutainment game. I only learned the ABSOLUTE basics in that class, such as do/loops, for/next statements, rem statements, etc. I never learned anything about sync or len or pos or mid$, so I'm sorry if I caused any complications or anything.

Also, my school has the full version of DBP, while my home computer only has the trial. My teacher said that there were some limitations in the trial, but I never learned what they were.

@Cs2009:
Your code gave me the same results that my code gave me. But thanks anyway.
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 26th Mar 2010 06:13
The problem with Wait is that you cannot do anything else while in the delay. If you have a game going and there are animations in the background, everything will freeze up while waiting.
NightX
15
Years of Service
User Offline
Joined: 3rd Apr 2009
Location: Australia, QueensLand
Posted: 26th Mar 2010 17:43 Edited at: 26th Mar 2010 17:56
as Ashingda27 said. it will freeze up, so here is a code example of a non freezing solution.

I tried to explain briefly as its the middle of the night, so it might not make sense, or written poorly.

as for the limitations, im sure you aren't aloud to use if for commercial use. an a few other things that i cant remember right now..



and here your code.



anyways, hopefully you somewhat understand it, im going to bed

luskos
17
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 28th Mar 2010 10:03
I`m pretty sure that there is working code snipet with this effect in the code base because i try it once.

Where there is a will, there is a way.
I often edit my posts, that`s who i am
kp1994
14
Years of Service
User Offline
Joined: 24th Mar 2010
Location:
Posted: 30th Mar 2010 05:45
Thanks again to everyone's help. There were a lot of suggestions, but I think that NightX's code worked the best for me. I was able to figure out how to position where the typing starts, how far apart the letters are, how fast to type it, etc. Thanks for that suggestion of code, and I appreciate everyone else's help.

If it ain't broke, make it broke so you can fix it.

Login to post a reply

Server time is: 2024-11-27 12:18:42
Your offset time is: 2024-11-27 12:18:42