CSE 131 (Fall 2008)

  1. We want the game to have realistic behavior in terms of the arrow in flight. Discuss as a group how to reason about the forces that are applied to an arrow.
  2. What are convenient units for the arrow's velocity and acceleration? For distance, consider pixels, but what unit should be used for time?
  3. In terms of graphics coordinates, which direction is positive and negative in each dimension?
  4. In terms of a playing surface of various sizes, how do you want gravity to work? For example, if the window is 200 pixels in height, should the arrow fall slower, faster, or at the same rate as when the window is 400 pixels in height? Is gravity the same force regardless of height or should it change?
  5. What equation models the path taken by the arrow? How would you represent that equation, using (if possible) classes we have developed this semester?
  6. Below you see a sketch of a Trajectory class. As a group, fill in the methods based on your discussion of the above topics.
    package game;
    import lab4.Vector;
    import lab4.Point;
     * Desribe the trajectory of a dart with gravity present.
     * Units are in pixels and seconds unless otherwise noted.
     * @author cytron
    public class Trajectory {
    	private Point start;
    	  * A trajectory from a starting point with an initial velocity.
    	public Trajectory(Point start, Vector initialVelocity) {
    		this.start = start;
            /** Return the current location, based on starting point,
              *   initial velocity, and time passed.
    	public Point getLocation() {
    	// TODO: fix below!
    		return start;
    	 * Advance time by the specified parameter
    	 * @param milliseconds Delta time
    	 * @return current time in milliseconds
    	public int advanceTime(int milliseconds) {

Last modified 07:14:42 CST 04 November 2008 by Ron K. Cytron