Discuss Scratch

rudra_cs
Scratcher
11 posts

Word wrap for typing game

I have made a typing game wher you can do typing practice but the words keep on getting half cut when typing I need someone to give me some codes to make a working word wrap for this game

: https://scratch.mit.edu/projects/1119655177
DragonPlusMaster
Scratcher
100+ posts

Word wrap for typing game

Hello! I happen to be some sort of an expert in this type of coding.
define Word Wrapping (text) (newLineX) ("wall")
set [f v] to (var that changes by one in the text engine script)
repeat until <<(f) > (length of (text))> or <(letter (f) of (text)) = [ ]>> // SPACE
change [f v] by [1]
end
set [i v] to ((f) - (var that changes by one in the text engine script))
if <((([0.18] * (size)) * (i)) + (x position)) > ("wall")> then
go to x: (newLineX) y: ((y position) - (round ((size) / [5])))
end
You might have to change the values 0.18 and 5 for it to fit your needs.
In the text engine script, this is where the block should be placed.
define Write (text) (x) (y)
go to x: (x) y: (y)
set [var that changes by one in the text engine script v] to [1]
repeat (length of (text))
switch costume to (letter (var that...) of (text))
if <(letter ((var that...) - [1]) of (text)) = [ ]> then // SPACE
Word Wrapping (text) (x) [240] :: custom
end
...
end

Last edited by DragonPlusMaster (Jan. 18, 2025 23:14:19)

rudra_cs
Scratcher
11 posts

Word wrap for typing game

Thanks and can you some how show me where to put these custome blokes on the code pls
DragonPlusMaster
Scratcher
100+ posts

Word wrap for typing game

Here ya go :D

Powered by DjangoBB