from visual import * # # this is meant to let people walk around with the standard doom # buttons- i dont really understand how the controls go # note that you can walk thru all of the objects # pmb, 9/27/02 # setup world floor = box ( size=(100,1,100), pos = ( 0,-3,0 )) ball = sphere ( pos = ( 0,0,30), radius=1,color=color.red) dunce = cone ( pos = ( 0,-3,-50), axis = (0,1,0), radius=10, color=(0.8,0.9,0.0), length=10) hoop = ring ( pos = ( 25,0,0 ), color=color.yellow) #make a house house1= box ( size= (20,5,20 ), pos =( -30,2,0 ), color=color.white ) house2= box ( size= (30,10,10 ), pos =( -30,7,10 ), color=color.white ) house3= box ( size= (10,7,20 ), pos =( -25,4,-10 ), color=color.white ) house4= box ( size= (15,20,15 ), pos =( -35,17,-12 ), color=color.white ) # make a tree tree =[ 0,0,0 ] tree[0] = cone ( pos= ( 20,-4,20 ), axis = ( 0,0.9,0.1 ), color=color.green, radius=5, length=7 ) tree[1] = cone ( pos= ( 20,0,20 ), axis = ( 0.1,0.9,0 ), color=color.green, radius=4, length=6 ) tree[2] = cone ( pos= ( 20,4,20 ), axis = ( 0,0.9,-0.1 ), color=color.green, radius=3, length=4 ) count =0 scene.autoscale =0 print dir(scene) while 1: # get key from keyboard s = scene.kb.getkey() #print "center is ", scene.center #print "camera is ", scene.mouse.camera #print "forward is ", scene.forward, "\n" # go forward if ( s == "up" ): scene.center = scene.center + scene.forward # go back if ( s == "down" ): scene.center = scene.center - scene.forward # go left if ( s == "left" ): newforward = rotate (scene.forward, axis=(0,1,0), angle=pi/30 ) scene.center = scene.mouse.camera + newforward * mag ( scene.mouse.camera- scene.center) scene.forward = newforward # go forward if ( s == "right" ): newforward = rotate (scene.forward, axis=(0,1,0), angle=-pi/30 ) scene.center = scene.mouse.camera + newforward * mag ( scene.mouse.camera- scene.center) scene.forward = newforward #shutdown autoscale after 1st lap if ( count > 0 ): scene.autoscale = 0 count = count+1