Mercurial > hg > Members > e085737 > sample
view Pants_FPS/resources/walk.js @ 17:bf87fe5a9797
ver3
author | <e085737> |
---|---|
date | Fri, 10 Dec 2010 20:19:03 +0900 |
parents | 9367d87879ee |
children | 931ad40d56f5 |
line wrap: on
line source
no_move_idle = function(){ } no_collision_idle = function(){ } test_move = function(){ this.xyz[1] += this.dy * 0.1 } jump_move = function(node, sgroot, w, h){ var jump = -80.0 var g = 19.8 var t = node.time var height = jump*t + (g * t * t) if(height > 0){ position_xyz[1] = 0 aim_xyz[1] = 0 node.time = 0 node.set_move_collision(walk_move,walk_collision) }else{ position_xyz[1] = height aim_xyz[1] = height } node.time += 0.1 } walk_move = function(node, sgroot, w, h){ } walk_init = function(gl, sgroot, w, h){ sgroot.createFromXMLfile(gl, sgroot, "./xml/pants.xml") sgroot.createFromXMLfile(gl, sgroot, "./xml/colorball.xml") sgroot.createFromXMLfile(gl, sgroot, "./xml/cube.xml") sgroot.createFromXMLfile(gl, sgroot, "./xml/ground.xml") sgroot.createFromXMLfile(gl, sgroot, "./xml/hand.xml") sgroot.createFromXMLfile(gl, sgroot, "./xml/blue.xml") sgroot.createFromXMLfile(gl, sgroot, "./xml/human.xml") var walk_man = createHuman(sgroot, w, h) var land = new sgroot.createSceneGraph1("Cube") land.set_move_collision(no_move_idle, no_collision_idle) land.angle[1] = 90 land.xyz[0] = 175 land.xyz[1] = 7 land.xyz[2] = 175 var wall = new sgroot.createSceneGraph1("Plane") wall.angle[1] = 90 wall.xyz[1] = 175 wall.xyz[2] = 175 var pants = new sgroot.createSceneGraph1("Pants") pants.set_move_collision(pants_move, pants_collision) pants.xyz[0] = 100 pants.xyz[2] = 500 pants.scale = 10 var root = new sgroot.createSceneGraph3() root.set_move_collision(no_move_idle, no_collision_idle) root.addChild(land) root.addChild(walk_man) //land.addChild(wall) root.addChild(pants) sgroot.setCamera(sgroot, root) sgroot.setSceneData(root) //return sgroot }