TGC Codebase Backup



Radioactive decay by Dr Jiggle

4th Feb 2004 12:27
Summary

decay experiment . No counter yet.



Description

This shows how particles with a certain chance of decay will act. They have a 500 to 1 chance of dissapearing every frame. They will aslo move and I've included camera controls. Later versions to include decay counters and other such. No additional files needed



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    hide mouse
sync on
sync rate 50
autocam off

obno=1
gosub lattice
color backdrop 1
position camera 50,200,50
pitch camera down 90
do

`CAMERA CONTROLS
if upkey()=1 then move camera 3
if downkey()=1 then move camera -3
turn camera right wrapvalue(mousemovex()/2)
pitch camera down wrapvalue(mousemovey()/2)
if leftkey()=1 then turn camera left 90:move camera 3:turn camera right 90
if rightkey()=1 then turn camera right 90 :move camera 3:turn camera left 90
if keystate(2)=1 then roll camera left 1
if keystate(3)=1 then roll camera right 1

`PARTICLE CONTROLS
for obno=1 to 121
if rnd(1)=0 then pitch object up obno,180
move object obno,0.1
if object position y(obno)>1 then pitch object up obno,180
if object position y(obno)<-1 then pitch object up obno,180
if rnd(499)+1=obno then hide object obno
next obno

sync
loop

lattice:
for x=0 to 100 step 10
for z=0 to 100 step 10
make object sphere obno,15
position object obno,x*1.5,0,z*1.5
color object obno,rgb(0,255,0)
a=rnd(1)
if a=0 then pitch object up obno,90
if a=1 then pitch object down obno,90
obno=obno+1
next z
next x
return