parseimg is a small utility library for turning raster ImageData into higher-level shapes, which can be useful for visually defining game data without having to hardcode and tweak numbers inside a text editor, or having to write your own game editor. The algorithms here have been sitting in different forms for a while in my misc utilities bucket, where I've used them for:
* simple tilemaps
* object placement in non-tiled maps
* hitboxes for character sprites
* spatial positioning for UI/HUD elements
and probably more. to see exactly how parseimg does this, check out the code and included comments:
https://gist.github.com/Alloyed/d66abd4 ... 2e201a4c0b
A simple example+screenshot is attached. It doesn't show how you'd actually use these algorithms in a game but hopefully it gives you a sense of how they behave so you can imagine your own examples:
parseimg - parses images
parseimg - parses images
- Attachments
-
- parseimg-v0.1.love
- (8.82 KiB) Downloaded 118 times
Re: parseimg - parses images
This is pretty neat! What are the rectangles inside the circles representing? Sometimes they are centered but sometimes they are not.
Re: parseimg - parses images
It's basically the center of the circle, rounded to the closest pixel. The cases where they aren't centered is because the center is actually in between two pixels, and the algorithm will actually give you the fractional position if you want it, for example {x = 2.5, y = 2.5, r = 3.5}, but usually I just round it off in practice
- yetneverdone
- Party member
- Posts: 446
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: parseimg - parses images
Cool!
Please correct me if im wrong, is one of its possible uses is to render a "part" of a large image? Im guessing based on the screenshot.
Please correct me if im wrong, is one of its possible uses is to render a "part" of a large image? Im guessing based on the screenshot.
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Who is online
Users browsing this forum: No registered users and 69 guests