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 Discussion / Explosions from Exgen??

Author
Message
Hangar18
19
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 18th Mar 2007 12:58
Hi All, I'm seriously thinking about buying Exgen but before I do, I want to be sure i can use the premade explosions (for a space sim). In this regard have a few questions.

1) import as an AVI file seemed the easiest choice but the animation didnt play right to the end (it stopped just before the last few "fireworky" fragments disappeared. Also the problem with the file was I needed to somehow create a background of stars in the animation sequence. This left me with alternative 2.

2) importing the explosion from Exgen as a serious bitmap images is fine but I have no idea how to use the bitmap images. For instance, if the ship that is about to blow up is object 50, and there are 20 frames to the explosion (and hence 20 bitmap files), then presumable the code needed is something like this:

hide object 50
load "Explosion1.bmp", object 1
position object 1,20,20 rem (where ship was previously)
load "explosion2.bmp",2
position object 2,20,20
load "explosion2.bmp",3

I'm abit new to this so if anyone can see anything obvious I'm doing wrong or has any suggestions, I would be extremely grateful. On a more positive note I'm making great progress with manipulating ships in the 3D environment
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 18th Mar 2007 15:50 Edited at: 18th Mar 2007 15:51
I'd suggest you load all the images before you start the game, to avoid a slowdown due to loading time.

for example:

And you just loaded 20 images in three lines ranging from 1 to 20

In the game itself, it's enough to create a separate variable to handle the current animation frame number.
An example would be:

To initialize:


To initiate or trigger an explosion


And to handle each explosion withing the game loop:


However, this code is untested and I can't guarantee it will work. It just gives the idea...

[edit] It might be a little confusing at first since I used an array to handle multiple explosions at a same time.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Hangar18
19
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 19th Mar 2007 11:12
Fantastic! Thanks so much for this. I couldnt quite get the array thing happening but you gave me enough to get it working for a single explosion which is good enough at this stage. Would you be able to help me with the following:

1. After the explosion runs, the last image remains on screen. I tried deleting that image but the image remained on screen. Is there a command to get rid of the image on screen?

2. Is there an easy way to make a transparent background in the image. What I mean is this. If I paste an image to screen, it appears as a square black box with the image inside it. I can forsee a problem in a situation where a ship blows up in front of say a planet. Sure the explosion will appear but the effect will be ruined if its contained within a square black box (i.e. part of the planet will be blocked by the black box while the image plays out).

3. How do you scale the images? Scale only seems to work for objects - the tutorials/examples didnt unfortunately help - is there an easy way to scale images so ships blown up far away have smaller explosions than those blown up near?

Thanks again for your help with the frames and for any help you can provide on the above.
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 20th Mar 2007 21:11
Try using sprites instead.

I'm sure you should be able to get what you need from the attached program....

All of your three points are covered in it.

TDK_Man

Hangar18
19
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 20th Mar 2007 23:12
Brilliant! Thanks a million!!!

Login to post a reply

Server time is: 2026-07-06 06:44:14
Your offset time is: 2026-07-06 06:44:14