Animating Glows (with lua!)
Allright, I'm pretty sure nobody's done this yet.
I figure that using a script to produce pretty looking effects has got to be useful to
someone, but I've stopped working on this just for now.
Basically, by first defining a ton of nearly-identical MOPIxels, each with an integer in the PresetName and with a corresponding ScreenEffect attached, you can then simply use a loop in Lua to spawn them sequentially.
I did this repetitive task using extensive Find&Replace, but I also made a junky bash script to do the same thing. You don't need it though.
Included in this proof-of-concept are a number of various bombs, each with a different effect.
The effects are edits of attack sprites from a mod for the game Mugen, specifically someone's Cirno character.
These effect will be included in a mod I am still developing, which is to be an entirely Lua-based floating actor, with a basic AI and lots of pretty. I intended to release it all at once, but I've slowed down development and well, I'm kinda bored.
Not to mention, I would love to see people implement this sort of thing.
That said, the animation script could use some work.
Ideally, it would not simply flash one frame at a time, but phase gently through them. I'll detail that better late, but you can see what I mean.
Glow animations included in this package:
Explode - It's a pretty-looking explosion effect, nice and large.
Implode - Really nice attach animation, repurposed as an implosion. My favorite looking thing there.
Beam - An energy attack splashing down from straight above. Glows are not the same size however, and it looks jittery.
Hegagram - A spinning and glowing hex, perfect for spinning below the body of a flying magician. The hexagram rotates forever, you can check out how simple it was to repeat the Lua script indefinitely.
Enough talk, it's better to look at how it was done.
The thing boils down to just this; spawning something based on a string and a formatted integer you just increase.
Here's some not-so-real code to explain, so you don't have to download.
Code:
if timer is past Xms, then
reset timer
local glow = CreateMOPixel(string.format("Explode Glow ".. self.GlowCounter)) //that's how to concatenate folks!
set glow's positon to self.Pos
Spawn the glow!
add one to the glow counter
if glow counter is greater than the number of frames then delete self end
end
Attachment:
File comment: Proof-of-concept
Cirno.rte.zip [2.15 MiB]
Downloaded 255 times
Thanks to those guys (you know who you are) who tried to help me with this and the associated glows.
TODO:
Spawn two glows at once, and use fading to smooth out animation.
Pass on velocity to spawned glows, so you can make something like this move.