====================================================================== ===== COMP2720 ===== Semester 2, 2006 ===== Lab sheet ===== ====================================================================== Student name: Dean Dal Broi Student Uni ID: u4222206 Lab goup: Wed 10-12 Tutor: Peter Christen ---------------------------------------------------------------------- Lab number: Homework 2 Date: 21/10/06 ====================================================================== Part 1. I created a dog with a cylinder as its body a sphere as its head, two cones as its ears and 2 boxes as its legs. I then made this all into a frame using the exaple from the Visual Python reference manual. I then inserted this frame into the bounce2.py program and removed all of the other objects from it. I then played around with the side variable to get the dog bouncing correctly off the walls. I did not need to resize the box as i made the dog small enough. I got the dog to rotate using the same rotation code from bounce2.py I then saved the program as bounceObject.py Part 2. I added a key listener into the infinite loop to listen for 's' and 'f' to speed up and slow down the motion accordingly, when the key listner detects that one of those keys are pressed it increments or decrements the rate accordinly and also prints a message of what it is doing. The following code was used for the key listner: #check for a key press if scene.kb.keys: key = scene.kb.getkey() if key == 'f': #if f has been pressed print "speeding up" loopRate = loopRate + 10 elif key == 's': #if s has been pressed if loopRate > 19: loopRate = loopRate - 10 print "slowing down" I learnt how to use the key listner from the Visual Python refernece Manual. Once I completed the function I saved it as bounceObjectKey.py ======================================================================