package graphic; import noise.NoiseGenerator; import processing.core.*; public class Mountain extends Graphic{ PApplet p; NoiseGenerator n; float xOff; float yOff; float xPlus; float yPlus; float para; PVector position; PImage mountain; PImage mountainNight; public Mountain(PApplet p, NoiseGenerator n, float x, float y, int c){ super(p, n, x, y, c); this.n = n; this.p = p; xPlus = 0; yPlus = 0; position = new PVector(0,380); para = 1; try{ mountain = p.loadImage("../images/snowMountain.png"); mountainNight = p.loadImage("../images/nightMountain.png"); }catch(NullPointerException e){ p.println("There is an error with the image file."); } } public void drawMe(){ p.pushMatrix(); p.translate(position.x, position.y); p.imageMode(p.CORNER); p.image(mountain, 0,0); position.x-= 3; if(position.x <= -p.width){ position.x = 0; } p.popMatrix(); } public void drawMeNight(){ p.pushMatrix(); p.translate(position.x, position.y); p.imageMode(p.CORNER); p.image(mountainNight, 0,0); position.x-= 3; if(position.x <= -p.width){ position.x = 0; } p.popMatrix(); } }