Snow Demo by MrNick7th Jun 2004 10:44
|
---|
Summary This is a simulation of a guy walking around in the middle of a snow storm. Description This is a simulation of a guy walking around in the middle of a snow storm. He leaves a tral in the snow. and all external media this program uses it makes itself. give me credit if you plan to use this code. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com rem Snow Demo remstart Please give me credit if you plan to use this code in any way, thanks. MrNick on the TGC forums remend REM "Other" Settings Sync On Sync Rate 1000 autocam off Rem -----------------Create World------------------- Set Text size 90 set text font "arial" Center Text 320,240,"Loading..." sync rem create textures box 0,0,200,200 for p = 1 to 75 remstart To ensure seamless texture, a random value of 190 is used instead of 200. remend dot rnd(190),rnd(190),RGB(228,228,228) next p for p = 1 to 75 dot rnd(190),rnd(190),RGB(0,255,255) next p get image 1,0,0,200,200 cls remstart Since we just cleared the screen, we need to refresh the "loading" message. remend Center Text 320,240,"Loading..." sync Rem Create snow for t = 1 to 100 step 2 for i = 1 to 100 step 2 m=m+1 Make object cube m,2 position object m,t,-2,i next i next t rem make ground make matrix 1,100,100,10,10 SET MATRIX WIREFRAME OFF 1 position matrix 1,0,-3,0 rem make player make object sphere 20000,2 hide object 20000 position camera 50,0,50 rem make snowflakes for t = 20001 to 20600 make object sphere t,0.3 position object t,rnd(100),rnd(10),rnd(100) next t rem ----------------make environment------------------ rem create fog fog on fog color RGB(187,255,255) fog distance 50 set ambient light 70 rem create skyboxes make object sphere 30000,100 texture object 30000,1 set object 30000,1,1,0 set object collision to polygons 30000 position object 30000,50,0,50 scale object texture 30000,0.25,0.25 make object sphere 30001,150 texture object 30001,1 set object 30001,1,1,0 position object 30001,50,0,50 scale object texture 30001,0.25,0.25 ink RGB(0,0,0),RGB(255,255,255) set text size 15 rem --------------------main loop--------------------- do sync control camera using arrowkeys 0,1,5 position object 20000,camera position x(),0,camera position z() remstart since the player object deletes anything it collides, we need to make sure it never collides with the skybox. remend if object collision (20000,0) = 30000 then position camera px#,0,pz#:position object 20000,camera position x(),0,camera position z() if object collision (20000,0)>0 then delete object object collision (20000,0) px# = object position x(20000) pz# = object position z(20000) gosub csf Center text 320,440,"Use the arrowkeys to move around." loop rem control snowflakes csf: for j = 20001 to 20600 if object exist(j) position object j,object position x(j),object position y(j)-0.2,object position z(j) if rnd(40)=25 position object j,object position x(j),12,object position z(j) endif endif next j return |