mspraggs / potentia

Southampton Game Jam 2015
0 stars 0 forks source link

Explosions. #88

Closed DivFord closed 9 years ago

DivFord commented 9 years ago

I've added an explosion tile-sheet to the gfx folder. I'm not sure how well it will fit in with the rest of the art, so if someone could have a shot at implementing it, that would be great.

It's intended to play row by row, at about 0.05 frames per second. The last row is empty, and is only their because I like powers of two.

Fyll commented 9 years ago

Wow, that looks great! It'd be nice if it was all on one line though...

At the moment when a block explodes, it scatters out as particles. Is this animation supposed to be on top of the block's sprite, with the pieces scattering, fading out, or just sitting there without changing?

As far as implementation goes, the two ways I can think of are to either add a new Object (called Explosion or something), or make it a special case in Fire (or a child of Fire even. I think that code uses pointers). My preference is to make it a special case of Fire, as then most of the code is already there, but it will basically mean sticking a bunch of 'if's into the code (not that there's much code in there to start with).

DivFord commented 9 years ago

Really? One line is easier to do output, so I can replace it if you want.

Not sure I understand the question. I'll try to answer it anyway. I would keep the shattering of the block, and just stick this animation behind it. Layers of visual effects tend to look better, so it makes sense to keep your existing particles in there.

Isn't fire attached to the flaming object? I feel like this would make more sense if we just created it at a point and had it destroy itself once it completed the animation. I may be misunderstanding.

Fyll commented 9 years ago

If it was going to be using the standard animation code (which it probably won't be, now that I think about it). Nevermind then.

Animation behind the particles? I was picturing it on top of them.

Fire is owned by the Objects, but Particle Effects can't be on fire (at least, in no cases that I can think of), so the Fire owned by the Particle Effects could just be an explosion. However, that was assuming the explosion was on top of the particles (like Fire is).

EDIT: Also, something happened to the background on the main menu after I pulled....

DivFord commented 9 years ago

To be honest, the less you explain your coding process, the more sense it'll make.

The parallax backgrounds mess up the main menu. I'm going to fix it, but I wanted to push what I had before I hit another merge conflict.

Fyll commented 9 years ago

Okay, I've had a stab at implementing them. I decided to just make them Props that animate (and are lethal), then die. It all seems to work lovelily, but it does mean the explosions will have to be moved onto the Prop sprite sheet.

Also, when you said "0.05 frames per second", I assume you meant "0.05 seconds per frame"? Otherwise, that's a very slow explosion...

EDIT: Actually, having attempted to move the explosions onto the Prop sprite sheet, the explosions are massive! I can see now why having them all on the same line would be a tad impractical. I'm going to have a shot anyway (as theoretically, there're going to be a hell of a lot of things on the Prop sheet by the end anyway, and some of them will also probably be quite big).

Fyll commented 9 years ago

Okay, they've all been smooshed up together on one sheet. All the other props look quite small in comparison, but it looks very impressive in game! Stick an exploding crate somewhere to see it for yourself. I worry it may be a bit too large though...

DivFord commented 9 years ago

I did mean 0.05 seconds per frame. Good catch. Seems to work pretty well as a prop, and I find the size is about right. It's nice to give people a little leeway between touching the sprite and actually being killed.

I did get it to freeze after a while though:

crash

EDIT: I haven't managed to reproduce it at all though…

EDIT No. 2: Wait, yes I have. It's when you freeze the water with an explosive crate in it, then explode another crate near enough to hit the frozen one. I think...

Fyll commented 9 years ago

Freezing crates inside the ice is already pretty wierd. I assume what's happening is that the explosion is pushing the crate, which is then infinitely recursing as it can't actually move. Any collision/physics related bugs like that I'm currently ignoring, until I iron out this last stupid kink from the new physics engine.

A sort-of solution which I'd already been tempted to implement would be for the explosion to have the ability to smash things as well (dependant on distance). At the moment, it only pushes things, but I could tell it to smash the nearby ones too. Alternatively, I could just say to smash something if it is put under enough force.

DivFord commented 9 years ago

That last idea sounds like the best longterm solution. Having the explosion smash nearby crates doesn't sound like it would solve this problem very reliably, but it would definitely look cool...

Fyll commented 9 years ago

Okay. Large forces now smash things that can be smashed. The numbers won't be right until the collision engine's been updated, but it seems to be fine for now.

DivFord commented 9 years ago

Yay! Chain detonations!

I'll try making an explosive barrel prop sprite. With regards to prop sprites, we don't seem to use the destroyed crate animations anymore. Should I remove them from the sprite sheet?

Fyll commented 9 years ago

If you feel we don't need them. We can always pick them back off of an old version if we suddenly want them again for some reason.

Bear in mind that the code uses the ExplosionAndProps.png sheet now instead of the other two.