I'm testing out layered images to see how to use them. I have a question about using Layered Images in practice for complex sprites.
Let's say you have a sprite named rex that has separate eyebrow, eye, and mouth layers.
Let's say you have the following images:
rex_base
rex_pants_long
rex_pants_short
rex_shirt
rex_eyebrow_angry
rex_eyebrow_happy
rex_eyebrow_sad
rex_eye_angry
rex_eye_happy
rex_eye_sad
rex_mouth_angry
rex_mouth_happy
rex_mouth_sad
So I assume we set up our layered sprite like so:
Code: Select all
layeredimage rex:
always "rex_base"
group pants auto:
attribute long default
always "rex_shirt"
group eyebrow auto:
attribute happy default
group eye auto:
attribute happy default
group mouth auto:
attribute happy default
label start:
scene black
show rex at center
r "I am happy."
Okay...but how do you switch emotions with these different elements?
If you want the sprite to be happy, you'd want eyebrow, eye, and mouth to be happy.
If you want the sprint to be angry, you'd want eyebrow, eye, and mouth to be angry.
If you want the sprint to be sad, you'd want eyebrow, eye, and mouth to be sad.
That seems easy. You just type:
Code: Select all
show rex sad
show rex angry
show rex happy
But what if you want the sprite to be maniacal, you'd want angry eyebrow and eye, and a happy mouth.
Or if you want the sprite to be broody, you'd want angry eyebrow, sad eye and sad mouth.
Using the old method I set up a class with functions that would change the conditionals. So I could type:
$rexEmote.angry() or $rexEmote.manic() and it would set the conditionals so I'd get those emotions without having to type out all the specific eyebrow/eye/mouth combo over and over.
How does one do this mixing and matching in LayeredImages? Would I nest groups maybe?
Ideally, if I set up the Layered Image right, I should be able to type:
show rex happy
show rex manic
and have it all work out, right? But how do you set up the layered image to make that work? Is that possible?
I also don't quite understand why/when I'd use variable and prefix.
Also, for the life of me I couldn't get the layeredimage to take a transform property.
I tried all the following:
The documentation say the layered image statement can take transform properties...but I'm not making it work. What am I doing wrong here?