I made a small game in a non-ZGE engine, so this made me think how would the same project work in ZGE.
The mechanic I’m not sure about is the “calculate the relevant area” mechanic. Basically what I’d like to find out is how much (in pixels, but doesn't have to be super precise) of a certain sprite is overlapping with another sprite. The shape of one of the sprites is organic and animated (10 frames or so), while the other is rectangular.
This is what it currently looks like:
Is this possible to do in ZGE without using OpenGL calls?
Irregular sprite overlapping area
Moderator: Moderators
Re: Irregular sprite overlapping area
Hi rrTea,
*Didn't feel like adding support for sprite-mirroring so i mirrored the sprite in the spritesheet itself.
K
Sure. The only thing that is a little cumbersome is the fact that you can't access image data directly, so you need to copy the alpha channel of your image / spritesheet to a array ( using a BitmapExpression ) .. and if you want to use a spritesheet there's no way to access the spritesheet coordinate data, so you need to import / copy that to a persistent array ( this isn't a issue when using tiles ). Attached is a silly & dirty example*
*Didn't feel like adding support for sprite-mirroring so i mirrored the sprite in the spritesheet itself.
K
- Attachments
-
- Snap.zgeproj
- (19.76 KiB) Downloaded 339 times
Re: Irregular sprite overlapping area
I see, this way I could also adjust the precision of the detection too, that's great!
Thanks!
Thanks!
Re: Irregular sprite overlapping area
I agree, very cool example!