Text sprite extension

I think I remember seeing @richard live code a simple text sprite extension on a recent-ish livestream. Is that published anywhere?

I think adding “angle” and “power” text labels is one of the next features I’ll need in my Scorched Earth inspired tank game:

We’re still figuring out what the “proper” extension should look like, but I whipped up something real quick to unblock you:

2 Likes

Also for anyone curious the stream was Arcade Advanced Stream #10 - Game idea generator

3 Likes

Thanks!

After playing with it a bit, I think I probably do just want to dynamically update a sprite’s image (so, something closer to drawing primitives) rather than making a new sprite for each angle change. But with your extension source and @jwunderl’s link back to the stream, I’m sure I can write my own inline extension to do what I need. (And it’s nice to see an example of how to get the color picker to show up, instead of having to have the color table memorized!)

What is the correct way to draw text today? Under Images there are functions to draw rectangles, lines, and pixels, but nothing for text. Is there any other non-input requesting way (meaning, not a dialog)?

@joshmarinacci in blocks, the best way would probably just be to use the extension I linked above or to make your own. We’re still figuring out what the final APIs will be. If you’re just trying to print something to the screen, “sprite say” is the easiest

It surprises me that you would have trouble figuring out the final API. In the Image collection I see blocks for draw line in picture and draw rectangle in picture. I would expect something like draw text in picture where you provide the string, position, and color.

What other features are you considering? Font size? Layout?

We try to be careful when adding new blocks because it’s very difficult for us to remove a block once it has been shipped. Once it is out in the wild, teachers will take screenshots, people will write lesson plans, etc.

As for what questions we are considering:

  1. How do you measure how wide or tall the text will be after it is drawn?
  2. Should we even surface the printing literals (i.e. are “higher level” text sprites more useful)?
  3. How do we communicate that unicode characters use a different font and so they will be larger than ascii characters?
  4. Truncating strings so that they fit in a rectangle is complicated, how can we make that scenario simpler?
2 Likes