home *** CD-ROM | disk | FTP | other *** search
- Rem Project: FaceDemo
- Rem Created: 12/08/2002 04:09:58
- Rem Hours: 3
-
- rem Init
- sync on : sync rate 0 : backdrop off
-
- rem Load Head and prepare
- load object "media\Head.x",1
-
- rem Handle head eyes
- make object sphere 2,50 : glue object to limb 2,1,1 : hide limb 1,1
- make object sphere 3,50 : glue object to limb 3,1,2 : hide limb 1,2
- scale object 2,100,75,100
- scale object 3,100,75,100
-
- rem Black bloc for mouth
- make object sphere 4,75
- color object 4,0
- glue object to limb 4,1,0
- position object 4,0,55,-70
-
- rem Detail the eyes
- load image "media\refl.bmp",1
- load image "media\face2.bmp",2
- texture object 2,1 : rotate object 2,90,0,90 : scale object texture 2,2,1
- texture object 3,1 : rotate object 3,90,0,90 : scale object texture 3,2,1
- rotate object 2,270,180,0
- rotate object 3,270,180,0
-
- rem Create backdrop and body
- make object plain 201,1300,1000
- yrotate object 201,350
- load image "media\backdrop.jpg",201
- position object 201,100,10,380
- set object light 201,0
- texture object 201,201
- make object sphere 202,600
- scale object 202,60,100,60
- color object 202,0
- xrotate object 202,330
- position object 202,0,-210,150
-
- rem Reflective mirror
- stencilbuffervalid=0
- if statistic(2)=1
- stencilbuffervalid=1
- make object sphere 501,500
- position object 501,200,75,50
- scale object 501,30,80,40
- ghost object on 501
- set reflection shading on 501
- make object plain 502,5000,5000
- position object 502,0,0,-300
- set object light 502,0
- yrotate object 502,20
- endif
-
- rem Create smoke effect
- load image "media\smoke.tga",601
- for ss=0 to 9
- make object plain 601+ss,128,128
- position object 601+ss,-25-rnd(25),-50-(ss*50),-175
- zrotate object 601+ss,rnd(350)
- texture object 601+ss,601
- set object light 601+ss,0
- ghost object on 601+ss,0
- next ss
-
- rem Setup light
- set ambient light 0
- set point light 0,0,-100,-300
- set light range 0,500
-
- rem Setup color lights
- make light 1 : set point light 1,-300,0,-200 : color light 1,rgb(0,0,255)
- make light 2 : set point light 2, 300,0,-200 : color light 2,-255,255,-255
- make light 3 : set point light 3,0,-100,-300 : color light 3,500,-100,-100
-
- rem Create some particles
- load image "media\fire.bmp",42
- make fire particles 1,42,500,40-6,74,-245,2,20,3
-
- rem Load fire animation
- for ff=0 to 10
- load image "media\fire\fire"+str$(10000+ff)+".tga",301+ff
- next ff
- anim=301
-
- rem Setup camera
- set camera range 2,2000
- position camera 40,75,-250
- rotate camera 0,0,0
-
- rem Load all sounds
- load sound "media\sounds\fire.wav",1 : loop sound 1
- load sound "media\sounds\urg1.wav",2 : set sound speed 2,12000
- load sound "media\sounds\urg2.wav",3 : set sound speed 3,12000
- load sound "media\sounds\urg3.wav",4 : set sound speed 4,12000
-
- rem Main loop
- do
-
- rem Rotate face based on mouse position
- moverate#=100.0
- w#=wrapvalue(w#+2)
- px#=mousex()+cos(w#)*5
- py#=mousey()+sin(w#)*5
- xmouse#=curvevalue((320-px#)/10.0,xmouse#,moverate#)
- ymouse#=curvevalue((240-py#)/10.0,ymouse#,moverate#)
-
- rem Mouse coords
- mx=mousex() : my=mousey()
-
- rem Detect mouse pause
- if lastx=mx and lasty=my
- if timer()-lasttime>3000
- autofly=1 : play sound 2+rnd(2)
- endif
- else
- lastx=mousex() : lasty=mousey()
- lasttime=timer()
- autofly=0
- endif
-
- rem Automove fly
- if autofly=1
- position mouse rnd(640),rnd(480)
- endif
-
- rem Rotate Head
- position object 1,xmouse#,0,0
- position object 202,xmouse#/2.0,-210,150
- rotate object 1,ymouse#,xmouse#-10,0
-
- rem Flame animation in eyes
- texture object 2,anim : texture object 3,anim
- set sphere mapping on 2,2 : set sphere mapping on 3,2
- inc animp
- if animp>10
- animp=0
- inc anim : if anim>311 then anim=301
- endif
-
- rem Rotate mirror sphere
- if stencilbuffervalid=1
- mr#=wrapvalue(mr#+1)
- position object 501,200+(cos(mr#)*30),75+(sin(mr#)*10),100
- rotate object 501,340,35+180+(cos(mr#)*10),5
- texture object 502,anim
- endif
-
- rem Raise smoke
- for ss=0 to 9
- zrotate object 601+ss,wrapvalue(object angle z(601+ss)+0.03)
- if object position y(601+ss)>200
- position object 601+ss,-25-rnd(25),-200,-175
- else
- position object 601+ss,object position x(601+ss),object position y(601+ss)+0.1,-175
- endif
- next ss
-
- rem Update screen
- sync
-
- rem End loop
- loop
-
-
-