Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Game Over Screen - Closing Circle

Author
Message
BMacZero
19
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 23rd Feb 2008 05:28
You know those circles in old cartoons that always appear at the ending? They start really big and then close until the entire screen is black. I'm thinking this would provide an appropriate "you died" effect in my latest game (see sig).

However, the only way I can think of doing this is making an animated spritesheet with about 15 frames of a circle closing. This would be easy to code, but it requires a gi-monsterous bitmap with 15 frames the size of the screen, and it would be difficult to support many different resolutions without making several of said bitmaps in different sizes.

In addition, I think it would look nicer if it zoomed in on the location where the character died, and this also makes using an animated sprite inefficient and ineffective.

Does anyone see another way of doing this, or know of one?


Powered by Box2D Physics. Thanks Diggsey!
tiresius
22
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 23rd Feb 2008 07:11
Interesting effect. I don't have any code to support this but the theory is sound.

You have two sprites that are 100x100 each.

One would be an image of a completely black rgb(0,0,0) circle, with the edges being almost black, like rgb(1,0,0) or something. If you need a very crisp circle even when it is large then perhaps the sprite could be 512x512? Same difference...

The other would just be an image of almost black.

Then what you can do is scale the circle sprite to be very large, then shrink it over time. Use scale sprite/paste sprite. While you're shrinking it, fill in the 4 sides of the screen with the square sprite, making sure it fits the screen in relation to the circle sprite by using scale sprite/paste sprite.

Make sense?

I'm not a real programmer but I play one with DBPro!
Garzu
20
Years of Service
User Offline
Joined: 31st Oct 2004
Location: London
Posted: 23rd Feb 2008 11:18
how about setting everything to not being affected by ambient lighting, then setting up a spotlight behind the camera and reducing the cone of light in a loop ?

Finished Projects : Spellmaker (Old Boardgame, Dodgy DB Pro Multiplayer commands included!)
Current Project : PBeM version of War of the Ring in 3D.
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 23rd Feb 2008 11:26 Edited at: 23rd Feb 2008 11:27
Here's one I prepared earlier

http://www.thegamecreators.com/data/newsletter/newsletter_issue_33.html#12

And attached is the effect you are looking for, you could use the mask in it directly, or make it more elaborate.
Blobby 101
19
Years of Service
User Offline
Joined: 17th Jun 2006
Location: England, UK
Posted: 23rd Feb 2008 13:19
or you could use the 2-d commands:

when you die make the game go into a secondary loop. the code would look like this:

i just came up with this so hopefully it will work.


thanks to deathead for the sig! please Click on it!
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 23rd Feb 2008 15:44
It's a nice idea, but it has 3 problems...

1. The Circle command is very slow
2. It would be full of gaps
3. Circles are not persistent, you would have to draw all the circles every time.
Veron
18
Years of Service
User Offline
Joined: 22nd Nov 2006
Location:
Posted: 23rd Feb 2008 16:10
Quote: "Here's one I prepared earlier"


Lol, you sound like one of those chefs.

But yeah, circles aren't persistent, so you'd be re-drawing the circle. Like making a circle move in QBASIC... ahh, the memories.


BMacZero
19
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 23rd Feb 2008 16:21
Thanks for all the responses!

@Tiresius: Sounds like a good idea, it could be complicated to do all that scaling though. Might actually be more useful than Batvink's because it would be a lot easier to zoom in on a specific location.

@Garzu: That would probably work, but I'm working in 2D

@Batvink: That code looks like pretty spiffy. Thanks for making a mask for me, but that's not quite what I was looking for: I need just a plain old circle that starts bigger than the screen and shrinks until it's gone, leaving blackness behind it. I haven't had a chance to try it yet though, because this laptop seems to be having problems with DirectX.

@Batvink and Blobby: Yeah, I already tried that method. I got around problems 1 and 2 by drawing the circles onto bitmaps and using "get image", but the circles still had gaps between them.

I'll try some of these and get back to you guys.


Powered by Box2D Physics. Thanks Diggsey!
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 23rd Feb 2008 17:35 Edited at: 23rd Feb 2008 17:36
You can make any mask to go with that code. We had a competition based on the tutorial, and got some great effects. Basically, the transition is controlled by the mask, going from black to white. This will give your desired effect, and runs using the same code

BMacZero
19
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 23rd Feb 2008 17:59
Ah, I get it, now that I've actually read the article . That mask looks pretty good. I'm working on an effect using Tiresius's idea now, I'll see which one looks better. Though your code is easy to use and can produce a huge variety of effects, I think Tiresius's idea might actually work better for this, because it is much easier to customize the speed and have the circle zoom into a specific spot.


Powered by Box2D Physics. Thanks Diggsey!
BMacZero
19
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 23rd Feb 2008 20:40 Edited at: 23rd Feb 2008 20:41
Alright, here's an easy to use function to make the closing circle:

Use "InitiateDCircle()" to make the sprites
Use "ShrinkDCircle(Rate,X,Y)" every loop to close it in - a rate of 10 or 15 is usually good.



Thanks for the help, everyone!


Powered by Box2D Physics. Thanks Diggsey!

Login to post a reply

Server time is: 2025-08-09 01:37:52
Your offset time is: 2025-08-09 01:37:52