_sys:addPath('res')_dofile('cameracontrol.lua')function newRole() local msh = _Mesh.new() msh:attachSkeleton('girl.skl') msh:addSubMesh('arm.skn') msh:addSubMesh('face.skn') msh:addSubMesh('hair.skn') msh:addSubMesh('body1.skn') msh:addSubMesh('leg1.skn') msh.skeleton:addAnima('idle.san').name = 'idle' msh.skeleton:addAnima('skill.san').name = 'skill' return mshendmsh1 = newRole()msh2 = newRole()msh3 = newRole()msh4 = newRole()msh5 = _mf:createTeapot()_mf:saveRole('res/role1.rol', msh1)_mf:saveRole('res/role1.rol', msh2)_mf:saveRole('res/role1.rol', msh3)_mf:saveRole('res/role1.rol', msh4)_mf:saveRole('res/role1.ro2', msh5)mat0 = _Matrix3D.new():setRotationZ(1.6):mulScalingLeft(2,2,2):mulTranslationRight(40, 0, 0)mat1 = _Matrix3D.new():setTranslation(20, 0, 0)mat2 = _Matrix3D.new():setTranslation(-20, 0, 0)mat3 = _Matrix3D.new():setTranslation(0, 20, 0)mat4 = _Matrix3D.new():setTranslation(0, -20, 0)mat5 = _Matrix3D.new():setScaling(5, 5, 5)mat6 = _Matrix3D.new():setTranslation(20, -80, 0)cam1 = _rd.camera:clone()cam1.name = 'cam1'cam1.look.x = 20cam1.eye.x = cam1.eye.x + 20cam1.eye.z = cam1.eye.z + 5cam2 = _rd.camera:clone()cam2.name = 'cam2'cam2.look.x = 20cam2.look.y = -80cam2.look.z = 5cam2.eye.x = cam2.eye.x + 20cam2.eye.y = cam2.eye.y - 80cam2.eye.z = cam2.eye.z + 5function newMovie() mov = _Movie.new() mov.scene = _Scene.new('water-scene.sen') mov:addRole(msh1, mat1).name = 'role1' mov:addRole(msh2, mat2).name = 'role2' mov:addRole(msh3, mat3).name = 'role3' mov:addRole(msh4, mat4).name = 'role4' mov:addRole(msh5, mat5).name = 'role5' mov.graData:addCamera(cam1) mov.graData:addCamera(cam2) act0 = mov:addAction('act0') s = act0:addStep() s.camera = cam1 s = act0:addStep() s.role = 'role1' s.anima = 'skill' s.speed = 0.5 s = act0:addStep() s.role = 'role2' s.anima = 'idle' s = act0:addStep() s.role = 'role5' s.bindRole = 'role1' s.bindSource = '' s.bindTarget = 'righthand' s = act0:addStep() s.role = 'role5' s.start = 2400 s.bindRole = 'empty' s = act0:addStep() s.role = 'role5' s.start = 2400 s.stop = 3400 s.target = mat6 s = act0:addStep() s.start = 2400 s.stop = 3400 s.camera = cam2 s = act0:addStep() s.start = 2400 s.name = 'pfx1' s.pfx = 'pfx_smoke.pfx' s.target = mat6 s.target:mulScalingLeft(10, 10, 10) s = act0:addStep() s.start = 4400 s.name = 'pfx1' s.pfx = 'empty' act1 = mov:addAction('act1') s = act1:addStep() s.role = 'role1' s.anima = 'skill' s = act1:addStep() s.stop = 2000 s.role = 'role1' s.target = mat0 s = act1:addStep() s.start = 500 s.stop = 2000 s.fadeFrom = 0 s.fadeTo = 0xff000000 act2 = mov:addAction('act2') s = act2:addStep() s.role = 'role1' s.anima = 'skill' s = act2:addStep() s.stop = 2000 s.role = 'role1' s.target = mat1 s = act2:addStep() s.start = 0 s.stop = 1500 s.fadeFrom = 0xff000000 s.fadeTo = 0 act3 = mov:addAction('act3') s = act3:addStep() s.start = 2400 s.name = 'sfx1' s.sfx = 'audio2.mp3' s = act3:addStep() s.start = 4400 s.name = 'sfx1' s.sfx = 'empty' mov:save('res/test.mov') return _Movie.new('res/test.mov')endmovie = newMovie()movie:getAction('act0'):play()movie:getAction('act3'):play()_app:onKeyDown(function(key) if key == _System.Key0 then mov.scene:del(n1) end if key == _System.Key1 then movie:getAction('act1'):play() end if key == _System.Key2 then movie:getAction('act2'):play() end if key == _System.Key3 then movie:getAction('act3'):play() endend)_app:onIdle(function(e) movie:draw()end)