[SUG] Animate grenader projectile

Started by WillLem, April 10, 2023, 12:16:23 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

WillLem

Quote from: jkapp76 on April 09, 2023, 03:20:09 AM
I love the looker state. It totally seems like the best thing to do.

Glad you like it! :thumbsup:

Quote from: jkapp76 on April 09, 2023, 03:20:09 AM
Are we getting a different grenade graphic some time?

I quite like the 'exploding cookie', so I'm going to keep it as that by default. If you want to change this, head to gfx\mask and see the two 'projectiles' images; you can find the cookie here, and you're of course welcome to mod your own copy to have this projectile appear however you'd like.

Quote from: jkapp76 on April 09, 2023, 03:20:09 AM
It would be cool if ... every few frames it switched from vertical to horizontal to make it look like it flipping end-over-end

Great idea (and I'm fairly sure the current codebase can support it since the Spear graphic is 'animated'). I'll look at this for a future release, but probably won't include it in the next release because there's already quite a hefty list of stuff I need to get sorted and my time on the project is becoming more and more limited.

Thanks for your continuing support, I appreciate it :)

jkapp76

I'm not unhappy with the cookie, I thought I read somewhere that it was a temporary graphic. I imagined some WW2 grenade with a handle flinging around was coming. lol

I don't think I'll change it for my computer.
...Jeremy Kapp

WillLem

#2
Quote from: jkapp76 on April 10, 2023, 02:32:39 AM
I'm not unhappy with the cookie, I thought I read somewhere that it was a temporary graphic

Initially, it was... :lemcat:

It actually used to be a grenade graphic (i.e. back when it was first implemented in NeoLemmix), but I changed it to a cookie because I thought it was funnier.

When bringing it back, I copied over my adapted 'cookie' graphic and I guess I just like it too much to want to change it. I'll definitely look at adding animation capability though, and that way users can customise their graphic and animate it as well, if they wish.

WillLem

#3
Had a look at this today. It's not as straightforward as I originally imagined it would be.

I can animate the grenade, sure - it now has 4 frames of 5x5 pixels each for up, down, left and right-facing grenade graphics. However, at the moment I can only sync it to the lemming's actions... so, if at any point the lemming changes actions (for example, if they're mid-Looker state and a Builder is assigned to them), the animation resets.

It's difficult to say how much of a problem this is, since the Grenade is only on-screen for a very short time and so it's barely noticeable in real-time. But, it is definitely noticeable when framestepping and keeping an eye on the Grenade itself.

So, another approach... the codebase tracks whether or not the projectile has actually been thrown, so there may be a way to "get" the current frame at the point it's released from the thrower's hand, and then incrementally add frames to that point, changing the graphic every 2 frames. I'll give that a try and see if it works. That didn't work.

On closer inspection of how the Spear animation works, it's calculated based on the distance from the thrower lemming. So, there might be an even better way to do this: the animation could become incrementally slower the further away from the lem the Grenade gets, spinning quickly at first then almost stopping spinning if it gets far enough away that it's going below the lem's Y position.

WillLem

#4
And, done! :lemcat:

The grenade performs 2 complete spins in an exponentially-slower spinning animation, before settling on the "upright" graphic (which is also the graphic used for the icon, pickup skill and pre-thrown state).

I like the cookie too much to change it in all honesty, but users are of course welcome to mod their own copy. The graphic can be found in styles\default\grenades: "grenades.png" and "grenades-hr.png" for low and hi-res, respectively. The "upright" Grenade is the first frame at the top left, then the next 3 are right-facing, down-facing and left-facing. Each frame is marked with a guide arrow, like this:



Feel free to get creative and create your own animated grenade graphic!

Commit 78169f53f implements this feature. Available from SuperLemmix 2.4 onwards

jkapp76

#5
I love the cookie. But I also love a challenge.
I made four frames to repeat.
These grenades are 9x19 pixels, possibly too tall?
*edit: Looks a bit small, but it's close to actual hand-size.
...Jeremy Kapp

WillLem

#6
Quote from: jkapp76 on June 14, 2023, 04:11:07 AM
I made four frames to repeat.

Due to the way the animation is set up to repeat the 4 frames for the "spin" effect, the wick would keep resetting, which would look a bit odd. Instead, we'd have to decide that we want a bomb with a wick and then tailor the animation accordingly. However, since the Grenade detonates on contact, putting a wick on the graphic doesn't make much sense. Also, it could potentially be confusing for new players who might expect the bomb to detonate when no wick remains.

Quote from: jkapp76 on June 14, 2023, 04:11:07 AM
These grenades are 9x19 pixels, possibly too tall?

We can have it as big as we like, but I think 5x5 (10x10 hi-res) is plenty big enough - it's actually 1px (2px in hi-res) wider than the current graphic.

Nice idea though - as I said, users are welcome to draw the Grenade graphic however they like. The cookie will remain the default; I'm not going to replace it at this point.




Topic closed 21/7/23