Creature - /* / Creature.java Author: Lewis/Loftus / /...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // Creature.java Author: Lewis/Loftus // // Solution to Programming Project 8.18 // // Represents a graphical creature //******************************************************************** / import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.Random; i public class Creature { private ImageIcon creature; private int creatureX, creatureY; private int catchCount; private Random gen; //----------------------------------------------------------------- // Creates the creature //----------------------------------------------------------------- public Creature(Image image) { creature = new ImageIcon(image); catchCount = 0; gen = new Random(); } //----------------------------------------------------------------- // Moves the creature to a random location within area //----------------------------------------------------------------- public void move(Dimension area) { creatureX = gen.nextInt(area.width - creature.getIconWidth());
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Page1 / 2

Creature - /* / Creature.java Author: Lewis/Loftus / /...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online