Reading and drawing a font in ActionScript

I created a small pixel font that I want to use in a Flash game.

Each letter has a height of 6 pixels and a width of 7 pixels. I saved a PNG file with all the letters from AZ located next to each other.

Basically, I would like to have a system in which I specify a PNG file and say: "A - position (0,0) - (7,6), B - position (7,0) to (14, 6) and etc. ", then visualize them individually on the screen in the form of letters in my font.

I was inspired to do this by watching (Minecraft creator) Notch do this in a video about his creation of Megagun .

So, has anyone done anything like this before? Is there a simple library that will allow me to do this already?

Thank!

+3
source share
1 answer

What you are talking about is called a "sprite sheet", and there is a ton of project that does such things. The best starting place, probably Ben Silvis' AS3: introduction to the use of sprites . Also check out AS3: SpriteSheet class - sprite extraction .

There are also tools for creating sprite lists from flash animations such as SWFSheet by Keith Peters

+2
source

Source: https://habr.com/ru/post/1792409/


All Articles