CST112 -- Project #6: Use objects, constructors, and methods
Create an object to represent your creature.
Everything about this creature is part of the object
(i.e. as properties and mehtods of the object)
Then, make more creatures
(each with different properties)
Using the "Processing" language,
make a sketch according to the following specifications:
Object:
- Properties should include:
- // Coordinates (x,y) of the creature.
- // Velocity: distance (in x and in y) to move each frame
- // Color of this creature
- // "Name" (a string to display on this creaqture)
- Include at least three different constructors.
- Include methods s follows:
- void move() // Move (x,y) coordinates of creature; bounce off walls.
- void show() // Display creature on screen.
- boolean hit( Creature other ) // True when there is a collosion with another creature
- void collide( Creature other ) // Collide "elastically" -- exchange velocities.
(Also create a circle that lasts for 5 frames after collision;
fill and stroke should be the colors of the colliding objects.)