Skip to content

Instantly share code, notes, and snippets.

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;
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;
//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);
}
}
//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")) {
//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")) {
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
// 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();
// 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();
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;