Add action to crop/trim a sprite object #2843
Replies: 5 comments
-
A rectangle-only crop feature would meet your needs, but I'm curious if it would be generally useful. A rectangular crop is straightforward to do as a separate animation, and it wouldn't incur the runtime cost of masking the sprite. However, something that would meet your need and have other uses would be the ability to have a collision mask also apply as a visual mask. That would take advantage of the existing mask editor and you'd still get to reuse the sprite image. |
Beta Was this translation helpful? Give feedback.
-
@ssangervasi thanks for taking the time to respond. My main goal with this feature is to write extensions that cut up a sprite into dozens of pieces that can then fall to the ground (or be exploded outward, or in a direction). I don't understand how your suggestion helps me accomplish that. |
Beta Was this translation helpful? Give feedback.
-
The way you do it in GDevelop seems to me to be the best possible solution. Another solution would be to add prefabs to the game engine. |
Beta Was this translation helpful? Give feedback.
-
@ssangervasi I think I finally understand what you mean; only show the part of the sprite that inside the standard collision hitbox. That sounds like it could work, but I would need the ability to change that hitbox for each instance of an object, and do it using actions. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I was thinking you'd have N animations defined with different hitboxes through the sprite properties, then use actions to switch animations |
Beta Was this translation helpful? Give feedback.
-
Description
I want the ability to cut out sections of a sprite that can then be used for programmatic destruction animations.
For instance, to slice a sprite in half:
vqdk4G0gvs.mp4
I also want to use this feature for other animations, such as exploding or crumbling. I can fake this right now by using a full copy of the sprite:
PKp9YhtaBU.mp4
You can currently adjust the width and height of a sprite, but that simply does the same thing as changing scale; it stretches and compresses the sprite.
Solution suggested
Inputs:
Output:
Beta Was this translation helpful? Give feedback.
All reactions