Difference between revisions of "CSC111 Final Exam 2015"

From dftwiki3
Jump to: navigation, search
Line 22: Line 22:
 
==The Banner==
 
==The Banner==
 
<br />
 
<br />
The banner at the top of the screen is an object of the class given below.
+
The banner at the top of the screen is an object of a class called '''Banner''', which is given below, along with a main program that illustrates how to use it.
<br />
 
::<source lang="python">
 
class Banner:
 
    def __init__( self, message ):
 
        self.text = Text( Point( WIDTH//2, 20 ), message )
 
        self.text.setFill( "black" )
 
        self.text.setTextColor( "black" )
 
        self.text.setSize( 20 )
 
       
 
    def draw( self, win ):
 
        self.text.draw( win )
 
        self.win = win
 
       
 
    def setText( self, message ):
 
        self.text.setText( message )
 
 
 
</source>
 
<br />
 
An example of how to use it is illustrated below:
 
 
<br />
 
<br />
 
::<source lang="python">
 
::<source lang="python">
Line 96: Line 77:
 
</source>
 
</source>
 
<br />
 
<br />
 +
==Implementation==
 +
<br />
 +
* You '''must''' use objects to define the cars.
 +
* The number of cars used by the program is fixed and does not grow as the game evolves.  In the video, the number of cars is 3, but you can use more.  When a car disappears on one end of the screen it reappears on the other side, after a short delay.  The delay is up to you.
 +
* The frog moves up or down by a fixed amount.  To make the frog move up, the user must click the mouse in the area of the window above the road.  To make the frog move down, the user clicks the mouse in the area of the window below the road.
 +
* The frog "dies," or loses a ''life point'' when it is run over by a car.  You are free to determine the conditions for which the program will determine that the car is running over the frog.  In the video the top or bottom of the frog can overlap slightly a car without triggering the program to detect an overlap.  There is flexibility.
 +
  
  

Revision as of 14:20, 21 April 2015


...