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.

Newcomers DBPro Corner / Crash / NoseDive / Explosion Effect???

Author
Message
maowan
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location:
Posted: 21st Apr 2003 01:07
Can anyone help me?
I am trying to create an explosion effect, and maybe a "crash landing" effect.

Apart from my below code, Scorpyo has written some cool code that simulates objects flying over the players head(see "flying objects" topic), I intend to incorperate his code with the code demonstrated here.

(I have set up a matrix and camera etc on this code for testing purposes.)


The below code enables the player to click on (shoot) the cubes using the mouse (i will change this to a crosshair).


I have put in a fade object command for testing purposes.



Instead of the fade object command i need something that handles the destruction of the cubes... such as an explosion effect.
Another great thing would be that if the player clicks on the cube, it dives towards ground level, and then explodes.


How would I program the cube so that once it has been clicked on it takes a nose dive towards the ground and then explodes?


I have tried "particle" scripts and move commands etc, but i cant seem to get anything to work..... has anyone got any ideas?


Also how could I program it so that the cube only nose dives/explodes after it has been clicked on (shot) a number of times? like 4 times or something..?

(when you execute this code you may need to swivel the camera round to find the cubes).
Check it out, see what you think


maowan
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location:
Posted: 21st Apr 2003 01:15
oops, try this instead of that code

maowan
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location:
Posted: 21st Apr 2003 01:16
ARGRRRR, try THIS








KamaKase
22
Years of Service
User Offline
Joined: 29th Oct 2002
Location:
Posted: 21st Apr 2003 01:32
...you'll need a variable for each cube. Say

cubelife1=4
cubelife2=4
cubelife3=4
cubelife4=4
cubelife5=4


if mouseclick()=1 and guncool=-1
guncool=3
for c=1 to 5
if object visible(c)=1 and object angle z(c)=0
sx=object screen x(c)
sy=object screen y(c)
mx=mousex() : my=mousey()
if mx>sx-20 and mx<sx+20 and my>sy-20 and my<sy+20


rem --test-------
if c=1 then dec cubelife1
if c=2 then dec cubelife2
if c=3 then dec cubelife3
if c=4 then dec cubelife4
if c=5 then dec cubelife5
rem -------------

endif
endif
next n
endif
if cubelife1=<0 then fade object 1,1
if cubelife2=<0 then fade object 2,1
if cubelife3=<0 then fade object 3,1
if cubelife4=<0 then fade object 4,1
if cubelife5=<0 then fade object 5,1

That's basically it, as for the thingy

instead of fade object bit put ermmmm....
if cubelife1=<0 and cubedead1=0 then cubdie1=1
if cubdie1=1
if cubedie(1)=1 then cubedead1=1
endif

function cubedie(obnum)

point object obnum object position x(),object position y()-100,object position z()
move object obnum,1
if object collision with matrix (not sure of function sorry)=1 then : cubef=1

endfunction return cubef

I'm sure there's a much more practical way of doing this. But I'm not too good at coding. Especially as I'm drunk and am doing this off te top of my head. Proably wont work, (like most of my things) you'll have to tinker with it.

Login to post a reply

Server time is: 2024-11-24 11:00:29
Your offset time is: 2024-11-24 11:00:29