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
Sync On
Sync Rate 30
Backdrop on
Set camera range 1,50000
Color Backdrop RGB(100,128,128)
Make matrix 1,10000,10000,20,20
randomize matrix 1,125
X#=5000
Z#=5000
for c = 1 to 5
make object cube c, 50
color object c, RGB(200,0,200)
position object c, rnd(300),rnd(600),rnd(8000)
move object c, 10
next c
do
REM -------Setup Camera rotation etc.-----------
OldCamAngleY# = Camera Angle Y()
OldCamAngleX# = Camera Angle X()
CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*0.2)
CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*0.2)
Yrotate camera CurveAngle(CameraAngleY#,OldCamAngleY#,24)
Xrotate camera CurveAngle(CameraAngleX#,OldCamAngleX#,24)
Y# = Get ground height(1,X#,Z#)
Position Camera X#,Y#+50,Z#
REM --Player clicks on cube-----
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 mxsy-20 and my0 then dec guncool
sync
loop