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.

Code Snippets / Destructable 2D Landscapes via Memblocks, Pointers and Backbuffer Commands

Author
Message
CodemanV
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location: South Wales Valleys, UK
Posted: 10th Sep 2006 04:20 Edited at: 10th Sep 2006 04:25
Hello

Coded with Dark Basic Professional Vesion 6.something

This is a snippet that does what the thread title suggests - blows stuff up in 2D

Similar to games like Worms, it basically destroys mountains, buldings, whatever images you choose to use.

It uses a combination of the various DBP memory commands to do what it does.

Here's a couple of screenshots.

Before, everything was nice and calm
[img][img=http://img152.imageshack.us/img152/8954/destuctable2dlandscapescreenie001sm6.th.jpg]
[/img]

After a total mass carnage fest with mouse button.
[img][img=http://img181.imageshack.us/img181/7167/destuctable2dlandscapescreenie002eu1.th.jpg][/img]


All required files (DBP source files and media) have been attached in a zip folder.

The source file is commented but any questions about how it is coded are welcome.

It's not perfect or anything, it is meant more as a demo of the principles involved in blowing up landscapes in 2D.

Usage :
Just the mouse buttons
Left Button triggers an explosion event at the mouse cursor position
Right Button switches between Single and Multi Explosion modes

Credits :
IanM for invaluable advice on using the Backbuffer Commands
David Gervais for the 2D artwork
sshhhhhh!.... don't tell him, I didn't actually ask him.
but he seems like a nice person so I don't think he'll mind.

Enjoy.

*** edit ***
Also, a compiled EXE is in the zip file for those without access to DBP.

Attachments

Login to view attachments
CodemanV
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location: South Wales Valleys, UK
Posted: 10th Sep 2006 08:48
Hello Again

Here's another version using sprites for the explosions.

Only one mode for this one, just click the Left mouse button for explosions.

Everything required is in the zip attachment below.

Attachments

Login to view attachments
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 10th Sep 2006 16:33
Looks like you accomplished this same way as me. Looks great!

Olby
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 11th Sep 2006 17:12
Finally someone can now recreate Worms (which is quite a nice game) in DBP...

"Error at line 0 - Your game sucks. Try again loser..." (Cash Curtis II)
AMD Sempron 3.1+ Ghz, 512MB Ram, ATI R9550 256MB Ram, Sound Blaster Live!, WinXP SP2, DirectX 9.0c, DBP 6.2
CodemanV
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location: South Wales Valleys, UK
Posted: 12th Sep 2006 23:13
Thanks for replies

@Andrew Neale - I've gone memblock and pointer mad lately. They definately add an edge to DBP programs. There's so much potential with what you can do with them. Very versatile.

@Olby - I'll be posting a version soon with simple projectiles and basic collision detection. I started this off with Worms in mind, although the first demo will be a tribute to QBasic Gorillas. A classic in it's own right. Ahhh, the hours spent in Uni playing .... uuhhh ... I mean studying that game. he-he-he.

Login to post a reply

Server time is: 2024-11-23 03:17:07
Your offset time is: 2024-11-23 03:17:07