
-----------------------------------
Tasty Pastry
Fri May 19, 2017 10:00 pm

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?



var chars : array char of boolean

proc TypewriterPrint(text : string) 
loop
Input.KeyDown (chars)
 if chars (KEY_ENTER) then
  for i : 1..length(text) 
    delay(50) 
    put text(i) .. 
  end for 
  put ""
else
for i : 1..length(text) 
  delay(100) 
  put text(i) .. 
 end for 
 put ""
end if
end loop
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

-----------------------------------
Insectoid
Sun May 21, 2017 1:33 pm

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[/code]

You should re-format it as follows:

[code]
loop
    for each letter
        %decide speed
        print letter
        delay (speed)
   end for
end loop[/code]

-----------------------------------
Tasty Pastry
Sun May 21, 2017 2:11 pm

Re: RE:Typewriter Effect in Turing
-----------------------------------

You should re-format it as follows:



Thank you so much! It works now.
