Login
Community
DARK THEME

I'd like to see more code for altering sprites

I'd like to see the ability to shift the palette of sprites or parts of sprites. I'd also like to see the ability to warp sprites, or at least the way they're drawn on screen. In a lot of RPGs, the death animations are made by altering the palette and deleting rows of pixels from the sprite, or by shifting separate rows left and right. Specifically, when I re-created this kind of effect in a different language, I had the following sorts of tools.

sprite.SwapColor(oldrgb,newrgb)

sprite.Blend(hue_adjustment(r,g,b),BLENDING_OPERATION) The operation could be add,subtract,multiply,and,or,overlay,underlay

sprite.DrawBox(rgb,x1,y1,x2=x1,y2=y1) null can be used for rgb to erase parts of the sprite.

I know there's already code to draw boxes, but that's directly onto the screen if I'm not mistaken. I'd also like to split a sprite up into parts and layer it all together but that's probably already possible in Microstudio. Sorry if my requests are already possible in the language, I haven't been toying around with Microstudio for very long.

The future holds many things for microStudio, but yes, for now you just have to tinker with what is there.

Some blending can be done with screen.setBlending(), gilles fixed up my first go at it:

:embed https://microstudio.io/gilles/blendingfixed/

Furthermore there are ways for direct sprite manipulation where you can read and set single pixels.
Check out the 'subs' here: Petridish unpunched
or also here: Better energy

Live Long and Tinker

P.S. forgot ... and some fake warping .. I so wish we could 'skew'.

:embed https://microstudio.io/TinkerSmith/rotosprite/

Link

If not already done, it's always worth to join the microStudio discord channel :)

Discord Link

Thanks! I didn't see these functions from Petridish in the documentation. Or realize that it was sprite editing when I first saw the project.

sprites.grid.frames[0].getRGB(xt,yt)

sprites.grid.frames[0].setPixel(xt,yt,ct)

I'm sure I could hack together what I wanted out of these commands if I really wanted to! I'll keep it in mind!

@tinkersmith Yep, I wish we had a function so that a sprite could be rendered between 4 points like screen.drawSprite("sprite",x1,y1,x2,y2,x3,y3,x4,y4) - for 3d textures of course. The current method is waaay to slow. I've been doing some testing and it looks like the only viable method retaining speed is just to manipulate the sprite size depending on depth, which looks something like this:

(warning - this demo is definitely not tinker-proof and wandering tinkerers may get lost)

:embed https://microstudio.io/this_name_is_taken/sprite3d/6FS99S8D/

@StrawberryMilk9 What kind of thing are you planning to do? Playing around with sprite tools has been in my 'to-do' list for a while, so I'm curious what you want to come up with.

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community