This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.awt.Color; | |
| import javalib.soundworld.*; | |
| import javalib.tunes.*; | |
| import javalib.colors.*; | |
| import javalib.worldimages.FromFileImage; | |
| import javalib.worldimages.Posn; | |
| //import javalib.worldimages.RectangleImage; | |
| import javalib.worldimages.TextImage; | |
| import javalib.worldimages.WorldEnd; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.awt.Color; | |
| import java.util.ArrayList; | |
| import java.util.Arrays; | |
| import javalib.colors.Black; | |
| import javalib.worldimages.FromFileImage; | |
| import javalib.worldimages.Posn; | |
| import javalib.worldimages.TextImage; | |
| import javalib.worldimages.WorldEnd; | |
| import javalib.worldimages.WorldImage; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //is this brick touching a given Posn? | |
| public boolean isTouching(Posn p) { | |
| return Math.abs((p.x - this.ctr.x)) <= (this.width / 2) && | |
| Math.abs((p.y - this.ctr.y)) <= (this.height / 2); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //to move the player on key event | |
| public Wheelbarrow moveWB(String ke) { | |
| if ((this.outOfBounds() && ke.equals("left") && this.ctr.x < 200) || | |
| (this.outOfBounds() && ke.equals("right") && this.ctr.x > 200)) { | |
| return this; | |
| } | |
| else if (ke.equals("left")) { | |
| return new Wheelbarrow(new Posn(this.ctr.x - this.stride, this.ctr.y)); | |
| } | |
| else if (ke.equals("right")) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //to move the player on key event | |
| public Wheelbarrow moveWB(String ke) { | |
| if ((this.outOfBounds() && ke.equals("left") && this.ctr.x < 200) || | |
| (this.outOfBounds() && ke.equals("right") && this.ctr.x > 200)) { | |
| return this; | |
| } | |
| else if (ke.equals("left")) { | |
| return new Wheelbarrow(new Posn(this.ctr.x - this.stride, this.ctr.y)); | |
| } | |
| else if (ke.equals("right")) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.awt.Color; | |
| import java.util.Random; | |
| import tester.*; | |
| import javalib.funworld.*; | |
| import javalib.colors.*; | |
| import javalib.worldcanvas.*; | |
| import javalib.worldimages.*; | |
| //to represent a brick |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // CS 2510 Fall 2013 | |
| // Assignment 3 | |
| import tester.*; | |
| // to represent a list of Strings | |
| interface ILoS{ | |
| // combine all Strings in this list into one | |
| public String combine(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // CS 2510 Fall 2013 | |
| // Assignment 3 | |
| import tester.*; | |
| // to represent a list of Strings | |
| interface ILoS{ | |
| // combine all Strings in this list into one | |
| public String combine(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class WP { | |
| String url; | |
| String title; | |
| ILoItem items; | |
| //constructor to create a WP | |
| WP(String url, String title, ILoItem items) { | |
| this.url = url; | |
| this.title = title; |