Quote from: Barn Owl on Yesterday at 01:54:50Create your sprites, labeled something like Xof12.gif, Xof7.gif, Xof5.gif. So you have 27 sprites labeled accordingly. Add them to the puzzle room as objects, all them visible set to except o12of12.gif, o0of7.gif, and o0of5.gif. Also create 24 inventory objects (since you won't need the empty ones, there will be fewer.)
There's no real need to make 27 sprites, and definitely no need to have 24 inventory objects.
First, an object on screen may be combined of just a few sprites in any combination.
Second, inventory items may have their graphic and description changed dynamically, so even if you like to keep all 3 glasses in inventory then you need 3 items at most. The water level in a glass may be set and read using Custom Properties. You add a integer property called "water level" to inventory, and then it's pure arithmetic when you use one item on another.
I did not understand whether the OP wants to have them in inventory at all though, that has to be clarified.
About combining an object from multiple sprites. Try imagining how you break an object into parts. If you are experienced with graphical software then think about graphical layers. If not, think about paper cut outs which you may stick to each other.
A glass with the water is 2 parts: 1) an empty glass shape and 2) a water inside. So you need 2 sprites to represent a glass with any water level. Maybe you don't even need a water sprite since you can use a color to paint water. Of course you may use more sprites for a glass, for example, if you want to cover water with a half-transparent glass side. But that's details. It's up for the game author to define how it should look like. Anything is possible.
How to combine sprites on screen, so that you don't see unnecessary parts of a water sprite, beyond glass's edges?
There are 3 general ways.
METHOD 1. Use either a 3rd sprite with cut from a background image, surrounding the glass, or a walk-behind. Then arrange them in layers, ordered from bottom to top (or from distant to close, for the player's perspective).
- The water is the lowest layer. Place it with some offset relative to the glass's position, depending on the wanted water level.
- The surrounding background is the middle layer. It will cover the excess of a water sprite.
- The empty glass shape is the top layer.
METHOD 2. Have several sprites per a water "step". This way you don't have to bother with cutting excess water.
Glass is one sprite, and water is constructed from N steps. These steps may be each separate sprites, or just using a single "step" sprite, depending on the shape of the glass. But you have to use several objects: 12 objects for a glass with 12 levels, 7 objects for a glass with 7 levels, and so on.
This method requires much more objects than method 1, but may be easier to setup a scene in some circumstances.
Also, if you are okay to do bit more scripting, then you may use "room overlays" instead of objects, as overlays are created and deleted dynamically, and there's no limit of them.
METHOD 3. Dynamic sprites. That may sound scary at first, because it requires more scripting, but with dynamic sprites you may create a mix of virtually any number of sprites on a single sprite, and then assign the resulting sprite to the single object.
I think for the glass with the water the order of operations should be following:
- create an empty fully transparent dynamic sprite.
- either paint a water sprite with some offset (depends on water level), or fill part of the sprite with the water color.
- have a sprite with a fully opaque glass shape, and use function CopyTransparencyMask to copy surrounding transparency to the final sprite. That will cut out any excess of painted water.
- finally paint a glass's shape which lets see water inside.
While METHOD 1 and 2 can be used for room objects, they cannot be used for inventory items (at least not with default AGS inventory). So METHOD 3 suits inventory items more.
On another hand, there are ways to simplify things. For example, you may use, say, only 3 variants of sprites for inventory item: empty glass, half-filled glass, and fully filled glass. That will let you use METHOD 1/2 for glasses in the room, and a simple solution for the glasses in inventory.