Monele wrote:
I suppose that if I have 15 different sprites I want to blink in the exact same way, I'll still have to create 15 animation statements even though only the image reference changes ? :/
Yes, but you can use a function to make it easier.
Code: Select all
init:
python:
def flicker(im):
return Animation(im, 0.25, Null(), 0.25, im)
image flicker foo = flicker("foo.png")
image flicker bar = flicker("bar.png")
And so on.
For performance reasons, you should really hide the bottom image when covered... even if it's fully covered, it still gets drawn, which takes some time.
BCS wrote:
Pytom, can you do me the honor of explaining these somewhat difficult concepts? Like how you can make ONE blinking animation and layer it using composites on every other sprite? I finally figured out the coding by brute force after an hour of tinkering with it, but I've lost it since ...
You can just store the blinking animation in a python variable, and let other people use it that way. You then need to use
LiveComposite to composite the animation against other bits.
For example:
Code: Select all
init:
$ eyes = Animation(
"eyes_open.png", 10.0,
"eyes_half.png", 0.10,
"eyes_closed.png", 0.10,
"eyes_half.png", 0.10)
image foo happy = LiveComposite(
(400, 600),
(0, 0), "base.png",
(100, 100), "face_happy.png",
(100, 100), eyes)
image foo sad = LiveComposite(
(400, 600),
(0, 0), "base.png",
(100, 100), "face_happy.png",
(100, 100), eyes)