Re: [Super-tux-devel] Stalactite bad guy [patch]
Brought to you by:
wkendrick
From: Bill K. <nb...@so...> - 2004-03-11 11:23:41
|
On Thu, Mar 11, 2004 at 10:31:16AM +0000, Ricardo Cruz wrote: > Yheaa, first time I thought about the stalactite I wanted to implement that > way. And does BoboBot make use of an animation or a particle system? You could think of it as a 'particle' system, I guess. When the stalactite hits the ground, four ice cube pieces are created. They act like the other objects in the game (player, enemies, bullets), in that they are animated each frame. I can't remember, but their lifespan might even be randomly-generated, meaning they might not all disappear at once. There might one one left bouncing on the ground for a moment after the others have disappeared. It's rather simple coding/logic, but adds to the game nicely, because of this randomness. (Also notice in BoboBot that when you jump out of the water, you drip randomly for a few seconds. ;^) ) I'm honestly quite proud of BoboBot, so far as what the game looks like and feels like. It's a shame that I didn't make it a scrolling game, wrote it in a hard-to-maintain way (Super Tux is a BIT better, so you can imagine how bad BoboBot is! :^) ), and never ported it from Xlib to SDL. I tried rewriting it twice, but Super Tux was my best attempt at doing a scroller game. BoboBot might not look like much, but what's there is fairly fun and cute. ;^) <snip> > > If we were being REALLY fancy, we could hand-code a blur routine that would > > actually give more of a glass effect. But, since the graphics will be > > relatively small, blurring is relatively expensive, and it will eventually > > all be moving so fast, I don't think it's worth it... > > Not sure what you meant, but SuperTux has OpenGL support... As an option, I hope. ;^) I reinstalled my Debian system recently and only have software GL support right now, for example. ;^) It == SLOW! The gist of the idea is that instead of simply being see-through, or tinting the background, the ice could actually affect the clarity of the background behind it. I suppose one way to do it would be to: 1. Do a general blur of the area the stalactite takes (using a mask to determine which pixels we should blur, so that we don't waste time doing the full rectangular area around the object). e.g., using this mask: ##### -###- -###- -###- -##-- --#-- --#-- ...look at the pixels in the background (before drawing any part of the stalactite) and combine them to blur it. E.g., if the background looked like this: #--#- ----- #--#- ----- #--#- ----- #--#- ...we'd now have a bitmap that looks like this: ::-:: ?'-'? ?:-:? ?'-'? ?:-?? ??-?? ??-?? (Where "??" is bits we don't even care about... consider it 100% transparent) If we were to blit that back onto the screen, it would look like a weird blurred splotch on the background. That's a start, but now we can use a transparency mask to determine how MUCH of that blurry background to draw back onto the screen. (e.g., it would be very blurry on the edges, and less blurry in the center, where the stalactite is pretty much a cylinder.) Mix the current background, with this alpha-masked blurred version and NOW, we have a cool "invisible Predator" style effect! Finally, we can draw the stalactite itself. In the center (where the stalactite looks mostly like see-through glass), we would simply tint the slightly-blurred background... say, blue. On the edges, it would be less see-through. Perhaps with a 100%-opaque black outline on the edges, for a cartoon effect. I think I'll make something in Gimp to explain what I'm talking about. At this point, I'm just kinda bored and wasting time talking about this. I doubt we'll go into this 'blur' effect any time soon, if EVER, in Super Tux. :^) It sure is fun to think about, though! ;^) -bill! |