Discuss Scratch

CKCG
Scratcher
100+ posts

Custom Text Sprites

I want to make a sprite thats text changes controlled by code. I have some ideas on how to do this, but are extremely complicated. The simplest way to do this would to be to make a varible, make it visible and change it to the text I want, but then I wouldn't be able to move it or anything. Suggestions please!
mstone326
Scratcher
1000+ posts

Custom Text Sprites

Are you looking for a text engine? Do you have a project you've started you can show us and we can look at it.

If not a text engine that spells the word out letter by letter. You could create costumes of your entire text that should show. Name the costume something appropriate, set your variable to the name of the costume, the switch the costume the variable. Just note, that the costumes are case sensitive and can't be numbers to use this method.

setcurrent_texttogreetingswitchcostumetocurrent_text

I have a few ideas for you but am curious how you plan to use it.

See if this helps. It starts at costume1, then after 2 seconds it switches costume to “current_text”
https://scratch.mit.edu/projects/253522636/

Last edited by mstone326 (Oct. 18, 2018 00:52:12)

CKCG
Scratcher
100+ posts

Custom Text Sprites

I want to have the name of a parakeet (this is custom set by the user, and i cant make a costume for every possible name) in the form of a sprite.
mstone326
Scratcher
1000+ posts

Custom Text Sprites

That is why sharing the project always is helpful so we don't have to guess how to help. So you are looking for a text engine? Is it just letters? Or is it letters numbers and symbols. Give me a minute, I will share a quick example of a simple text engine.

You need a variable to count through each letter of the word.
CKCG
Scratcher
100+ posts

Custom Text Sprites

I've got to go now, talk later and thanks for helping so far
mstone326
Scratcher
1000+ posts

Custom Text Sprites

See if this helps. I broke it into 2 parts, The setup and the spelling. All letters in the list MUST be in capital letters. I normally use a list method but I wasn't sure if you were familiar with looping through a list. If you are, I can add a separate method.

This also uses clones. You could substitute with stamping. Note, stamps can not go on top of sprites. Also, I did not include a cloneID system. I wanted to keep as simple as I could.

https://scratch.mit.edu/projects/253523780/
CKCG
Scratcher
100+ posts

Custom Text Sprites

A really nice way to do it, I hadn't thought of doing it that way and I'll keep it in mind for future projects. Though, I was hoping to find a way to be able to move the text as well. I guess I could stamp and clear it a few times a second, but that's be inefficent and choppy.
mstone326
Scratcher
1000+ posts

Custom Text Sprites

You can move this text. This was a simple example.

I added movement. The text clones can do whatever you want them to do. Share the project so we can help better.

Last edited by mstone326 (Oct. 18, 2018 02:22:04)

CKCG
Scratcher
100+ posts

Custom Text Sprites

Sorry for not responding in a while. You solved my question tysm
Cutie_Poochi
Scratcher
49 posts

Custom Text Sprites

mstone326 wrote:

You can move this text. This was a simple example.

I added movement. The text clones can do whatever you want them to do. Share the project so we can help better.
I prefer not using global variables. Will release a project regarding this soon enough.

Last edited by Cutie_Poochi (Nov. 2, 2018 02:51:56)

Cutie_Poochi
Scratcher
49 posts

Custom Text Sprites

I Made It! wrote:

I prefer not using global variables. Will release a project regarding this soon enough.

Made it finally.
TariqjeMaakt
Scratcher
93 posts

Custom Text Sprites

h

Last edited by TariqjeMaakt (Dec. 13, 2019 23:05:41)

oscarfinley
Scratcher
100+ posts

Custom Text Sprites

please don't spam on a topic which is more than a year old
psychonaut2009
New Scratcher
1 post

Custom Text Sprites

Help I don’t know how to add a text sprite
Oumuamua
Scratcher
1000+ posts

Custom Text Sprites

psychonaut2009 wrote:

Help I don’t know how to add a text sprite

There is an article in ScratchWiki about this matter

https://en.scratch-wiki.info/wiki/Text_Rendering#Text_Rendering_with_a_Sprite
bopthing1
Scratcher
11 posts

Custom Text Sprites

I think another reason this would be cool is that you can customize it and stuff unlike variables. And also this would be easier to code for beginners.
MathPuppy314
Scratcher
500+ posts

Custom Text Sprites

bopthing1 wrote:

I think another reason this would be cool is that you can customize it and stuff unlike variables. And also this would be easier to code for beginners.

Please don't post on old topics. The problem has likely been resolved, and doesn't need more input.
Muhammad-4242
Scratcher
13 posts

Custom Text Sprites

i want it to be like that its a variable that we can type in
ZC-Burleigh02
Scratcher
2 posts

Custom Text Sprites

If you want to make changing text, you can use a pen-
whenclickedgotox:0y:0whenakeypressedpendowngotox:15y:0gotox:30y:-2gotox:0y:2gotox:-30y:2gotox:-15y:0gotox:0y:0penup
-to make text.
postmadebyZC-Burleigh02
My browser / operating system: iPadOS 15.3.1, Safari 15.3, No Flash version detected

Last edited by ZC-Burleigh02 (April 21, 2022 12:32:04)

ZC-Burleigh02
Scratcher
2 posts

Custom Text Sprites

psychonaut2009 wrote:

Help I don’t know how to add a text sprite
Make a sprite and add text. Simple as that.
definepostmadebynamesayjoinpost made by(name)whenclickedpostmadebyZC-Burleigh02

Last edited by ZC-Burleigh02 (April 21, 2022 12:38:53)

Powered by DjangoBB