Posted: Fri May 19, 2017 10:00 pm Post subject: Typewriter Effect in Turing
I'm trying to make a game in Turing, and I want to have an option to speed up the text as its appearing across the screen. I've been able to speed up the text, but only after another line has started. Is it possible to have it speed up whenever the user presses down a key?
Turing:
var chars :arraycharofboolean
proc TypewriterPrint(text :string) loop Input.KeyDown(chars) if chars (KEY_ENTER)then for i :1..length(text) delay(50) put text(i)..
endfor put"" else for i :1..length(text) delay(100) put text(i)..
endfor put"" endif endloop end TypewriterPrint
TypewriterPrint("This will be printed like a typewriter")
Sorry if my code is a little messy, I'm still learning the ins and outs of Turing.
Please specify what version of Turing you are using
4.11
Sponsor Sponsor
Insectoid
Posted: Sun May 21, 2017 1:33 pm Post subject: RE:Typewriter Effect in Turing
If you want to change the speed on a per-letter basis, then maybe you should put the code that decides the speed in the same loop as the code that prints the letters. You code is currently formatted as follows:
code:
loop
%decide speed
for each letter
print letter
delay (speed)
end for
end loop
You should re-format it as follows:
code:
loop
for each letter
%decide speed
print letter
delay (speed)
end for
end loop
Tasty Pastry
Posted: Sun May 21, 2017 2:11 pm Post subject: Re: RE:Typewriter Effect in Turing
Insectoid @ Sun May 21, 2017 1:33 pm wrote:
You should re-format it as follows:
code:
loop
for each letter
%decide speed
print letter
delay (speed)
end for
end loop