TGC Codebase Backup



Space Particles by flock

6th Aug 2006 13:40
Summary

Three functions: one to make the particles (set objects at 10 to 200), second to move them, and third to delete them. The movement function acquires a speed variable.



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                       function makeSpace()

	backdrop on
	color backdrop rgb(0,0,0)

	position camera 0,0,0
	autocam off

	for n = 10 to 50
		if object exist(n) = 0
			make object plain n,5,5
			position object n,rnd(2000),rnd(2000),(zd + rnd(3000))
		endif
		color object n,rgb(255,255,255)
		ghost object on n
	next n

	for ny = 51 to 100
		if object exist(ny) = 0
			make object plain ny,5,5
			position object ny,(rnd(1000) * -1),(rnd(1000) * -1),(zd + rnd(3000))
		endif
		color object ny,rgb(255,255,255)
		ghost object on ny
	next ny

	
	for nye = 101 to 150
		if object exist(nye) = 0
			make object plain nye,5,5
			position object nye,(rnd(1000) * -1),rnd(2000),(zd + rnd(3200))
		endif
		color object nye,rgb(255,255,255)
		ghost object on nye
	next nye

	for nyb = 151 to 200
		if object exist(nyb) = 0
			make object plain nyb,5,5
			position object nyb,rnd(1000),(rnd(2000) * -1),(zd + rnd(3200))
		endif
		color object nyb,rgb(255,255,255)
		ghost object on nyb
	next nye


	endfunction



	

	function space(zd)

		for zb = 10 to 200
			if object position z(zb) < 500
				position object zb,object position x(zb),object position y(zb),object position z(zb) + rnd(3200)
			endif
		next zb

		for zr = 10 to 200
			position object zr,object position x(zr),object position y(zr),object position z(zr) - zd
		next zr

	endfunction

	



	function destroySpace()

		for v = 10 to 200
			if object exist(v) = 1
				delete object v
			endif
		next v

	endfunction