Final Processing Project

import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

import sprites.*;
import sprites.maths.*;
import sprites.utils.*;

import net.java.games.input.*;
import org.gamecontrolplus.*;
import org.gamecontrolplus.gui.*;

ControlIO control;
ControlDevice stick;
Minim minim;
AudioInput in;
AudioPlayer button;
AudioPlayer button2;
AudioPlayer button3;
AudioPlayer door;
AudioPlayer door_2;
AudioPlayer door_3;
AudioPlayer skipSound;
FFT fft;
BeatDetect beat;

int iterations;
int frame = 0;
int numFrames = 3;
int anim = 0;
int wh = 0;

float px, py;
float ox, oy;
float tr;
float tl;
float framespeed = 1000;
float Mx, My;
float W1X = -800;
float W2X = 1200;

long timer;

boolean E1Alive = true;
boolean EAttack = false;
boolean P1Alive = true;
boolean skip = false;
boolean debug;
boolean cooldown = false;
boolean pushable = true;
boolean worldScrollR = false;
boolean worldScrollL = false;
boolean worldScrollU = false;
boolean worldScrollD = false;
boolean door1 = true;
boolean door2 = true;
boolean door3 = true;
boolean instruct = false;
boolean start = false;
boolean win = false;
boolean move1 = false;
boolean move2 = false;

Sprite Win1, Win2, Instruct, WinItem, HealthPK, Turret, Title, playerRight, playerIRight, playerPRight, playerSRight, playerDRight, playerLeft, playerILeft, playerPLeft, numbersBack, ladder, ladder2, ladder3, ladder4;
Sprite[] Beam = new Sprite[3], playerWRight = new Sprite[4], playerWLeft = new Sprite[4], numbers = new Sprite[6], playerClimb = new Sprite[4], TurretA = new Sprite[5];
Player P1;
Enemy E1;
Health HP;
Health_Item HI;
Ladder LD;
Ground G1;
Button BU;
Lazer LZ;
Hot_Floor HF;
Goal GO;

void setup() {

size(600, 400, P2D);
minim = new Minim(this);
in = minim.getLineIn(Minim.STEREO, 1050);
button = minim.loadFile(“button.wav”, 512);
button2 = minim.loadFile(“button.wav”, 512);
button3 = minim.loadFile(“button.wav”, 512);
skipSound = minim.loadFile(“skip.wav”, 512);

playerRight = new Sprite(this, “SPRITER.png”, 10);
playerWRight[0] = new Sprite (this, “SPRITEWR1.png”, 10);
playerWRight[1] = new Sprite (this, “SPRITEWR2.png”, 10);
playerWRight[2] = new Sprite (this, “SPRITEWR3.png”, 10);
playerWRight[3] = new Sprite (this, “SPRITEWR4.png”, 10);
playerPRight = new Sprite (this, “SPRITEPR.png”, 10);
playerIRight = new Sprite(this, “SPRITEIR.png”, 10);
playerSRight = new Sprite(this, “SPRITESR.png”, 10);
playerDRight = new Sprite(this, “SPRITEDR.png”, 10);
playerWLeft[0] = new Sprite (this, “SPRITEWL1.png”, 10);
playerWLeft[1] = new Sprite (this, “SPRITEWL2.png”, 10);
playerWLeft[2] = new Sprite (this, “SPRITEWL3.png”, 10);
playerWLeft[3] = new Sprite (this, “SPRITEWL4.png”, 10);
playerLeft = new Sprite (this, “SPRITEL.png”, 10);
playerPLeft = new Sprite (this, “SPRITEPL.png”, 10);
playerILeft = new Sprite(this, “SPRITEIL.png”, 10);
numbersBack = new Sprite(this, “NumbersBack.png”, 10);
numbers[0] = new Sprite(this, “Numbers5.png”, 10);
numbers[1] = new Sprite(this, “Numbers4.png”, 10);
numbers[2] = new Sprite(this, “Numbers3.png”, 10);
numbers[3] = new Sprite(this, “Numbers2.png”, 10);
numbers[4] = new Sprite(this, “Numbers1.png”, 10);
numbers[5] = new Sprite(this, “NumbersX.png”, 10);
ladder = new Sprite(this, “Ladder.png”, 10);
ladder2 = new Sprite(this, “Ladder.png”, 10);
ladder3 = new Sprite(this, “Ladder.png”, 10);
ladder4 = new Sprite(this, “Ladder.png”, 10);
playerClimb[0] = new Sprite (this, “SPRITECLIMB0.png”, 10);
playerClimb[1] = new Sprite (this, “SPRITECLIMB1.png”, 10);
playerClimb[2] = new Sprite (this, “SPRITECLIMB2.png”, 10);
playerClimb[3] = new Sprite (this, “SPRITECLIMB3.png”, 10);
Title = new Sprite (this, “Title.png”, 10);
Turret = new Sprite (this, “Turret.png”, 10);
TurretA[0] = new Sprite (this, “Turret0.png”, 10);
TurretA[1] = new Sprite (this, “Turret1.png”, 10);
TurretA[2] = new Sprite (this, “Turret2.png”, 10);
TurretA[3] = new Sprite (this, “Turret3.png”, 10);
TurretA[4] = new Sprite (this, “Turret4.png”, 10);
Beam[0] = new Sprite (this, “Beam0.png”, 10);
Beam[1] = new Sprite (this, “Beam1.png”, 10);
Beam[2] = new Sprite (this, “Beam2.png”, 10);
HealthPK = new Sprite (this, “HealthPK.png”, 10);
WinItem = new Sprite (this, “WinItem.png”, 10);
Instruct = new Sprite (this, “Instruct.png”, 10);
Win1 = new Sprite (this, “Win1.png”, 10);
Win2 = new Sprite (this, “Win2.png”, 10);

timer = millis();

P1 = new Player();
E1 = new Enemy();
HP = new Health();
HI = new Health_Item();
LD = new Ladder();
G1 = new Ground();
BU = new Button();
LZ = new Lazer();
HF = new Hot_Floor();
GO = new Goal();

control = ControlIO.getInstance(this);
stick = control.getMatchedDevice(“XBOX_CONFIGURE”);
}

public void getUserInput() {

px = map(stick.getSlider(“L-Joy-Up/Down”).getValue(), -1, 1, 0, width);
py = map(stick.getSlider(“L-Joy-Left/Right”).getValue(), -1, 1, 0, height);
ox = map(stick.getSlider(“R-Joy-Up/Down”).getValue(), -1, 1, 0, width);
oy = map(stick.getSlider(“R-Joy-Left/Right”).getValue(), -1, 1, 0, height);
tr = map(stick.getSlider(“RT”).getValue(), -1, 1, 0, width);
tl = map(stick.getSlider(“LT”).getValue(), -1, 1, 0, width);
}

public void draw() {
Win1.setXY(W1X, 100);
Win2.setXY(W2X, 200);
getUserInput();
background(150, 150, 150);
if (start == false && instruct == false) {
Title.setXY(300, 200);
Title.draw();
if (stick.getButton(“Home”).pressed()) {
instruct = true;
}
}
if (start == false && instruct == true) {
Instruct.setXY(300, 200);
Instruct.draw();
if (stick.getButton(“A-Button”).pressed()) {
start = true;
}
}
if (start == true) {
LD.display();
HI.collect();
G1.door();
G1.door2();
G1.door3();
BU.display();
G1.display();
LZ.display();
LZ.hitbox();
E1.display();
E1.attack();
HF.display();
GO.display();
if (P1.xpos + 30 > BU.x -20 && P1.ypos <= LD.y) {
button.play();
}
if (P1.xpos + 30 > BU.wx && P1.ypos + 65 >= LD.by + 200) {
button2.play();
}
if (P1.xpos + 30 > BU.bx -20 && P1.ypos <= LD.by) {
button3.play();
}
HP.display();
if (P1Alive == true) {
if (win == false) {
P1.control();
}
P1.skip();
P1.hitbox();
if (win == true) {
noStroke();
fill(255, 255, 255, wh);
rect(0, 0, 600, 400);
Win1.draw();
Win2.draw();
if (wh < 255) {
wh = wh + 1;
}
if (wh == 255){
W1X = W1X + 20;
W2X = W2X – 20;
}
if (W1X >= 300 && W2X <= 300){
W1X = 300;
W2X = 300;
}

}
if (P1Alive == false) {
playerDRight.draw();
}
}
}
}


class Button {
int x;
int y;
int wx;
int wy;
int bx;
int by;

Button () {
x = 870;
y = 53;
wx = 3755;
wy = 480;
bx = 4290;
by = 253;
}

void display () {
if (stick.getButton(“Home”).pressed()){
x = 870;
y = 53;
wx = 3755;
wy = 480;
bx = 4290;
by = 253;
}
noStroke();
fill(250, 250, 250);
if (door1 == true){
rect(x, y, -20, 20);
}
if (door2 == true){
rect(wx, wy, 20, 20);
}
if (door3 == true){
rect(bx, by, 20, 20);
}
if (P1Alive == true){
if (P1.walk == true){
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos <= 600 && P1.ypos == 236) {
if (P1.skip == false) {
x = x – 8;
wx = wx – 8;
bx = bx – 8;
}
if (P1.skip == true) {
x = x – 18;
wx = wx – 18;
bx = bx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= 0 && P1.ypos == 236) {
if (P1.skip == false) {
x = x + 8;
wx = wx + 8;
bx = bx + 8;
}
if (P1.skip == true) {
x = x + 18;
wx = wx + 18;
bx = bx + 18;
}
}
}
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos + 30 <= 600 && P1.ypos <= 40) {
if (P1.skip == false) {
x = x – 8;
wx = wx – 8;
bx = bx – 8;
}
if (P1.skip == true) {
x = x – 18;
wx = wx – 18;
bx = bx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= G1.x – 40 && P1.ypos <= 40) {
if (P1.skip == false) {
x = x + 8;
wx = wx + 8;
bx = bx + 8;
}
if (P1.skip == true) {
x = x + 18;
wx = wx + 18;
bx = bx + 18;
}
}
}
}
if (P1.climb1 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
}
}
}
}
if (P1.climb2 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
}
}
}
}
if (P1.climb3 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
}
}
}
}
if (P1.climb4 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
}
}
}
}
}
}
}


class Enemy {
color v;
float x;
float y;
float wx;
float wy;
float E1xpos;
float bx;
float by;
float xspeed;
int anim = 4;
int anim2 = 3;
boolean EAttk = false;
boolean Ded = false;
Enemy() {
v = color(0);
x = 3300;
y = 480;
wx = 2200;
wy = 420;
bx = 3305;
by = 490;
xspeed = 1;
Turret.setXY(x,y);
}
void attack() {
Beam[0].setXY(bx+7,by+5);
Beam[1].setXY(bx+7,by+5);
Beam[2].setXY(bx+7,by+5);
if (stick.getButton(“Home”).pressed()){
x = 3300;
y = 480;
wx = 2200;
wy = 420;
bx = 3305;
by = 490;
}
noFill();
noStroke();
rect(bx, by, 10, 10);
if (EAttk == true){
anim2 ++;
if (anim2 > 2) {
anim2 = 0;
}
Beam[anim2].draw();
if (skip == false) {
bx = bx – 10;
}
if (skip == true) {
bx = bx – 50;
}
}
}
void display() {

Turret.setXY(x+10,y+23);
TurretA[0].setXY(x+10,y+23);
TurretA[1].setXY(x+10,y+23);
TurretA[2].setXY(x+10,y+23);
TurretA[3].setXY(x+10,y+23);
TurretA[4].setXY(x+10,y+23);
noFill();
noStroke();
rect(wx, wy, 1500, 150);
noStroke();
rect(x, y, 40, 40);
if (Ded == false){
Turret.draw();
}
if (Ded == true){
anim ++;
if (anim > 4) {
anim = 0;
}
TurretA[anim].draw();
}
if (P1Alive == true){
if (P1.walk == true){
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos <= 600 && P1.ypos == 236) {
if (P1.skip == false) {
x = x – 8;
wx = wx – 8;
bx = bx – 8;
}
if (P1.skip == true) {
x = x – 18;
wx = wx – 18;
bx = bx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= 0 && P1.ypos == 236) {
if (P1.skip == false) {
x = x + 8;
wx = wx + 8;
bx = bx + 8;
}
if (P1.skip == true) {
x = x + 18;
wx = wx + 18;
bx = bx + 18;
}
}
}
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos + 30 <= 600 && P1.ypos <= 40) {
if (P1.skip == false) {
x = x – 8;
wx = wx – 8;
bx = bx – 8;
}
if (P1.skip == true) {
x = x – 18;
wx = wx – 18;
bx = bx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= G1.x – 40 && P1.ypos <= 40) {
if (P1.skip == false) {
x = x + 8;
wx = wx + 8;
bx = bx + 8;
}
if (P1.skip == true) {
x = x + 18;
wx = wx + 18;
bx = bx + 18;
}
}
}
}
if (P1.climb1 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
}
}
}
}
if (P1.climb2 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
}
}
}
}
if (P1.climb3 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
}
}
}
}
if (P1.climb4 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
}
}
}
}
}
}
}


class Goal{
int x;
int y;
Goal(){
x = 2700;
y = 255;
}
void display(){
WinItem.setXY(x+5,y);
if (stick.getButton(“Home”).pressed()){
x = 2700;
y = 255;
}
noStroke();
fill(255, 220, 220);
rect(x, y, 10, 10);
WinItem.draw();
if (P1Alive == true){
if (P1.walk == true){
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos <= 600 && P1.ypos == 236) {
if (P1.skip == false) {
x = x – 8;
}
if (P1.skip == true) {
x = x – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= 0 && P1.ypos == 236) {
if (P1.skip == false) {
x = x + 8;
}
if (P1.skip == true) {
x = x + 18;
}
}
}
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos + 30 <= 600 && P1.ypos <= 40) {
x = x – 8;
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos > LD.x && P1.ypos <= 40) {
x = x + 8;
}
}
}
if (P1.climb1 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
}
if (P1.skip == true) {
y = y + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
}
if (P1.skip == true) {
y = y – 18;
}
}
}
}
if (P1.climb2 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
}
if (P1.skip == true) {
y = y + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
}
if (P1.skip == true) {
y = y – 18;
}
}
}
}
if (P1.climb3 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
}
if (P1.skip == true) {
y = y + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
}
if (P1.skip == true) {
y = y – 18;
}
}
}
}
if (P1.climb4 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
}
if (P1.skip == true) {
y = y + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
}
if (P1.skip == true) {
y = y – 18;
}
}
}
}
}
}
}


class Ground {

int x;
int y;
int bx;
int by;
int wx;
int wy;
int vx;
int vy;
int dx;
int dy;
int ddx;
int ddy;
int dddx;
int dddy;
int dsy;
int ddsy;
int dddsy;
int Trap;
int Trapx;
int Trapy;

Ground() {
x = 340;
y = 85;
bx = -100;
by = 290;
wx = 860;
wy = -100;
vx = 3760;
vy = 400;
dx = 500;
dy = 95;
ddx = 2150;
ddy = 95;
dddx = 2280;
dddy = 95;
dsy = 210;
ddsy = 210;
dddsy = 210;
Trapx = 2200;
Trapy = 400;
Trap = 0;
}

void display() {
if (stick.getButton(“Home”).pressed()){
x = 340;
y = 85;
bx = -100;
by = 290;
wx = 860;
wy = -100;
vx = 3760;
vy = 400;
dx = 500;
dy = 95;
ddx = 2150;
ddy = 95;
dddx = 2280;
dddy = 95;
dsy = 210;
ddsy = 210;
dddsy = 210;
Trapx = 2200;
Trapy = 400;
Trap = 0;
}

noStroke();
fill(100, 100, 100);
rect(x – 340, y – 385, 3440, 200);
rect(x, y, 560, 60);
rect(x + 1800, y, 200, 100);
rect(bx, by, 2100, 157);
rect(bx + 2140, by, 2300, 157);
rect(bx + 1800, by + 239, 2100, 157);
rect(x + 1600, y – 40, 960, 50);
rect(Trapx, Trapy, 40, Trap);
fill(70, 50, 50);
rect(bx, by, 2100, 30);
rect(bx + 2140, by, 2300, 30);
rect(bx + 1800, by + 239, 2100, 30);
rect(x – 340, y – 385, 3440, 30);
rect(x, y, 560, 30);
rect(x + 1600, y – 40, 960, 30);
fill(100, 100, 100);
rect(bx + 1780, by + 109, 300, 190);
rect(wx, wy, 40, 230);
rect(wx + 400, wy, 40, 200);
rect(wx + 2000, wy + 180, 40, 280);
rect(wx + 3440, wy, 40, 600);
rect(vx, vy, 40, 200);
rect(wx – 1300, wy, 400, 800);
if (P1Alive == true){
if (P1.walk == true) {
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos <= 600 && P1.ypos == 236) {
if (P1.skip == false) {
x = x – 8;
wx = wx – 8;
bx = bx – 8;
vx = vx – 8;
Trapx = Trapx – 8;
}
if (P1.skip == true) {
x = x – 18;
wx = wx – 18;
bx = bx – 18;
vx = vx – 18;
Trapx = Trapx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= 0 && P1.ypos == 236) {
if (P1.skip == false) {
x = x + 8;
wx = wx + 8;
bx = bx + 8;
vx = vx + 8;
Trapx = Trapx + 8;
}
if (P1.skip == true) {
x = x + 18;
wx = wx + 18;
bx = bx + 18;
vx = vx + 18;
Trapx = Trapx + 18;
}
}
}
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos + 30 <= 600 && P1.ypos <= 40) {
if (P1.skip == false) {
x = x – 8;
wx = wx – 8;
bx = bx – 8;
vx = vx – 8;
}
if (P1.skip == true) {
x = x – 18;
wx = wx – 18;
bx = bx – 18;
vx = vx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= G1.x – 40 && P1.ypos <= 40) {
if (P1.skip == false) {
x = x + 8;
wx = wx + 8;
bx = bx + 8;
vx = vx + 8;
}
if (P1.skip == true) {
x = x + 18;
wx = wx + 18;
bx = bx + 18;
vx = vx + 18;
}
}
}
}
if (P1.climb1 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
vy = vy + 8;
Trapy = Trapy + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
vy = vy + 18;
Trapy = Trapy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
vy = vy – 8;
Trapy = Trapy – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
vy = vy – 18;
Trapy = Trapy – 18;
}
}
}
}
if (P1.climb2 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
vy = vy + 8;
Trapy = Trapy + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
vy = vy + 18;
Trapy = Trapy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
vy = vy – 8;
Trapy = Trapy – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
vy = vy – 18;
Trapy = Trapy – 18;
}
}
}
}
if (P1.climb3 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
vy = vy + 8;
Trapy = Trapy + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
vy = vy + 18;
Trapy = Trapy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
vy = vy – 8;
Trapy = Trapy – 8;
}
}
}
}
if (P1.climb4 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
vy = vy + 8;
Trapy = Trapy + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
vy = vy + 18;
Trapy = Trapy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
vy = vy – 8;
Trapy = Trapy – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
vy = vy – 18;
Trapy = Trapy – 18;
}
}
}
}
}
}
void door3 () {
noStroke();
fill(120, 120, 120);
rect(dddx, dddy, 50, dddsy);
if (door3 == false && dddsy > 0) {
dddsy = dddsy – 1;
}
if (P1Alive == true){
if (P1.walk == true) {
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos <= 600 && P1.ypos == 236) {
if (P1.skip == false) {
dddx = dddx – 8;
}
if (P1.skip == true) {
dddx = dddx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= 0 && P1.ypos == 236) {
if (P1.skip == false) {
dddx = dddx + 8;
}
if (P1.skip == true) {
dddx = dddx + 18;
}
}
}
}
if (P1.climb2 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
dddy = dddy + 8;
}
if (P1.skip == true) {
dddy = dddy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
dddy = dddy – 8;
}
if (P1.skip == true) {
dddy = dddy – 18;
}
}
}
}
if (P1.climb1 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
dddy = dddy + 8;
}
if (P1.skip == true) {
dddy = dddy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
dddy = dddy – 8;
}
if (P1.skip == true) {
dddy = dddy – 18;
}
}
}
}
if (P1.climb3 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
dddy = dddy + 8;
}
if (P1.skip == true) {
dddy = dddy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
dddy = dddy – 8;
}
if (P1.skip == true) {
dddy = dddy – 18;
}
}
}
}
if (P1.climb4 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
dddy = dddy + 8;
}
if (P1.skip == true) {
dddy = dddy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
dddy = dddy – 8;
}
if (P1.skip == true) {
dddy = dddy – 18;
}
}
}
}
}
}

void door2 () {
noStroke();
fill(120, 120, 120);
rect(ddx, ddy, 50, ddsy);
if (door2 == false && ddsy > 0) {
ddsy = ddsy – 1;
}
if (P1Alive == true){
if (P1.walk == true) {
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos <= 600 && P1.ypos == 236) {
if (P1.skip == false) {
ddx = ddx – 8;
}
if (P1.skip == true) {
ddx = ddx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= 0 && P1.ypos == 236) {
if (P1.skip == false) {
ddx = ddx + 8;
}
if (P1.skip == true) {
ddx = ddx + 18;
}
}
}
}
if (P1.climb2 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
ddy = ddy + 8;
}
if (P1.skip == true) {
ddy = ddy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
ddy = ddy – 8;
}
if (P1.skip == true) {
ddy = ddy – 18;
}
}
}
}
if (P1.climb1 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
ddy = ddy + 8;
}
if (P1.skip == true) {
ddy = ddy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
ddy = ddy – 8;
}
if (P1.skip == true) {
ddy = ddy – 18;
}
}
}
}
if (P1.climb3 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
ddy = ddy + 8;
}
if (P1.skip == true) {
ddy = ddy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
ddy = ddy – 8;
}
if (P1.skip == true) {
ddy = ddy – 18;
}
}
}
}
if (P1.climb4 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
ddy = ddy + 8;
}
if (P1.skip == true) {
ddy = ddy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
ddy = ddy – 8;
}
if (P1.skip == true) {
ddy = ddy – 18;
}
}
}
}
}
}

void door () {
noStroke();
fill(120, 120, 120);
rect(dx, dy, 50, dsy);
if (door1 == false && dsy > 0) {
dsy = dsy – 1;
}
if (P1Alive == true){
if (P1.walk == true) {
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos <= 600 && P1.ypos == 236) {
if (P1.skip == false) {
dx = dx – 8;
}
if (P1.skip == true) {
dx = dx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= 0 && P1.ypos == 236) {
if (P1.skip == false) {
dx = dx + 8;
}
if (P1.skip == true) {
dx = dx + 18;
}
}
}
}
if (P1.climb2 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
dy = dy + 8;
}
if (P1.skip == true) {
dy = dy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
dy = dy – 8;
}
if (P1.skip == true) {
dy = dy – 18;
}
}
}
}
if (P1.climb1 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
dy = dy + 8;
}
if (P1.skip == true) {
dy = dy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
dy = dy – 8;
}
if (P1.skip == true) {
dy = dy – 18;
}
}
}
}
if (P1.climb3 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
dy = dy + 8;
}
if (P1.skip == true) {
dy = dy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
dy = dy – 8;
}
if (P1.skip == true) {
dy = dy – 18;
}
}
}
}
if (P1.climb4 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
dy = dy + 8;
}
if (P1.skip == true) {
dy = dy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
dy = dy – 8;
}
if (P1.skip == true) {
dy = dy – 18;
}
}
}
}
}
}
}


class Health {

float sizeX;

Health() {
sizeX = 200;
}

void display() {
if (win == false){
sizeX = sizeX – 0.1;
}
if (stick.getButton(“Home”).pressed()){
sizeX = 200;
}
noStroke();
fill(255, 0, 0);
rect(0, 0, sizeX, 30);
if (stick.getButton(“B-Button”).pressed()&& P1.skip == true) {
sizeX = sizeX – 1;
}
if (sizeX <= 0) {
P1Alive = false;
}
}
}


class Health_Item {

int x;
int y;
int bx;
int by;
int wx;
int wy;
int vx;
int vy;
int dx;
int dy;
boolean Collect = false;
boolean Collect2 = false;
boolean Collect3 = false;
boolean Collect4 = false;

Health_Item() {
x = 400;
y = 250;
bx = 1970;
by = 0;
wx = 3600;
wy = 470;
vx = 4000;
vy = 250;
dx = 400;
dy = 250;
}

void display() {
if (stick.getButton(“Home”).pressed()){
x = 400;
y = 250;
}
HealthPK.setXY(x+10,y+10);
noStroke();
fill(0, 255, 100);
rect(x, y, 20, 20);
HealthPK.draw();
if (P1Alive == true){
if (P1.walk == true){
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos <= 600 && P1.ypos == 236) {
if (P1.skip == false) {
x = x – 8;
}
if (P1.skip == true) {
x = x – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= 0 && P1.ypos == 236) {
if (P1.skip == false) {
x = x + 8;
}
if (P1.skip == true) {
x = x + 18;
}
}
}
}
if (P1.climb1 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
}
if (P1.skip == true) {
y = y + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
}
if (P1.skip == true) {
y = y – 18;
}
}
}
}
if (P1.climb2 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
}
if (P1.skip == true) {
y = y + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
}
if (P1.skip == true) {
y = y – 18;
}
}
}
}
if (P1.climb3 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
}
if (P1.skip == true) {
y = y + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
}
if (P1.skip == true) {
y = y – 18;
}
}
}
}
if (P1.climb4 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
}
if (P1.skip == true) {
y = y + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
}
if (P1.skip == true) {
y = y – 18;
}
}
}
}
}
}

void display2() {
if (stick.getButton(“Home”).pressed()){
bx = 1970;
by = 0;
}
HealthPK.setXY(bx+10,by+10);
noStroke();
fill(0, 255, 100);
rect(bx, by, 20, 20);
HealthPK.draw();
if (P1Alive == true){
if (P1.walk == true){
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos <= 600 && P1.ypos == 236) {
if (P1.skip == false) {
bx = bx – 8;
}
if (P1.skip == true) {
bx = bx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= 0 && P1.ypos == 236) {
if (P1.skip == false) {
bx = bx + 8;
}
if (P1.skip == true) {
bx = bx + 18;
}
}
}

}
if (P1.climb1 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
by = by + 8;
}
if (P1.skip == true) {
by = by + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
by = by – 8;
}
if (P1.skip == true) {
by = by – 18;
}
}
}
}
if (P1.climb2 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
by = by + 8;
}
if (P1.skip == true) {
by = by + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
by = by – 8;
}
if (P1.skip == true) {
by = by – 18;
}
}
}
}
if (P1.climb3 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
by = by + 8;
}
if (P1.skip == true) {
by = by + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
by = by – 8;
}
if (P1.skip == true) {
by = by – 18;
}
}
}
}
if (P1.climb4 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
by = by + 8;
}
if (P1.skip == true) {
by = by + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
by = by – 8;
}
if (P1.skip == true) {
by = by – 18;
}
}
}
}
}
}

void display3() {
if (stick.getButton(“Home”).pressed()){
wx = 3600;
wy = 470;
}
HealthPK.setXY(wx+10,wy+10);
noStroke();
fill(0, 255, 100);
rect(wx, wy, 20, 20);
HealthPK.draw();
if (P1Alive == true){
if (P1.walk == true){
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos <= 600 && P1.ypos == 236) {
if (P1.skip == false) {
wx = wx – 8;
}
if (P1.skip == true) {
wx = wx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= 0 && P1.ypos == 236) {
if (P1.skip == false) {
wx = wx + 8;
}
if (P1.skip == true) {
wx = wx + 18;
}
}
}
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos + 30 <= 600 && P1.ypos <= 40) {
if (P1.skip == false) {
wx = wx – 8;
}
if (P1.skip == true) {
wx = wx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= G1.x – 40 && P1.ypos <= 40) {
if (P1.skip == false) {
wx = wx + 8;
}
if (P1.skip == true) {
wx = wx + 18;
}
}
}
}
if (P1.climb1 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
wy = wy + 8;
}
if (P1.skip == true) {
wy = wy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
wy = wy – 8;
}
if (P1.skip == true) {
wy = wy – 18;
}
}
}
}
if (P1.climb2 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
wy = wy + 8;
}
if (P1.skip == true) {
wy = wy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
wy = wy – 8;
}
if (P1.skip == true) {
wy = wy – 18;
}
}
}
}
if (P1.climb3 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
wy = wy + 8;
}
if (P1.skip == true) {
wy = wy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
wy = wy – 8;
}
if (P1.skip == true) {
wy = wy – 18;
}
}
}
}
if (P1.climb4 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
wy = wy + 8;
}
if (P1.skip == true) {
wy = wy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
wy = wy – 8;
}
if (P1.skip == true) {
wy = wy – 18;
}
}
}
}
}
}

void display4() {
if (stick.getButton(“Home”).pressed()){
vx = 3700;
vy = 250;
}

HealthPK.setXY(vx+10,vy+10);
noStroke();
fill(0, 255, 100);
rect(vx, vy, 20, 20);
HealthPK.draw();
if (P1Alive == true){
if (P1.walk == true){
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos <= 600 && P1.ypos == 236) {
if (P1.skip == false) {
vx = vx – 8;
}
if (P1.skip == true) {
vx = vx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= 0 && P1.ypos == 236) {
if (P1.skip == false) {
vx = vx + 8;
}
if (P1.skip == true) {
vx = vx + 18;
}
}
}
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos + 30 <= 600 && P1.ypos <= 40) {
if (P1.skip == false) {
vx = vx – 8;
}
if (P1.skip == true) {
vx = vx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= G1.x – 40 && P1.ypos <= 40) {
if (P1.skip == false) {
vx = vx + 8;
}
if (P1.skip == true) {
vx = vx + 18;
}
}
}
}
if (P1.climb1 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
vy = vy + 8;
}
if (P1.skip == true) {
vy = vy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
vy = vy – 8;
}
if (P1.skip == true) {
vy = vy – 18;
}
}
}
}
if (P1.climb2 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
vy = vy + 8;
}
if (P1.skip == true) {
vy = vy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
vy = vy – 8;
}
if (P1.skip == true) {
vy = vy – 18;
}
}
}
}
if (P1.climb3 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
vy = vy + 8;
}
if (P1.skip == true) {
vy = vy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
vy = vy – 8;
}
if (P1.skip == true) {
vy = vy – 18;
}
}
}
}
if (P1.climb4 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
vy = vy + 8;
}
if (P1.skip == true) {
vy = vy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
vy = vy – 8;
}
if (P1.skip == true) {
vy = vy – 18;
}
}
}
}
}
}
void collect() {
if (Collect == false) {
HI.display();
if (P1.xpos+20 >= x && P1.ypos+65 >= y && P1.ypos <= y+20 && stick.getButton(“X-Button”).pressed()) {
Collect = true;
HP.sizeX = HP.sizeX + 20;
}
if (P1.xpos <= x+20 && P1.ypos+65 >= y && P1.ypos <= y+20 && stick.getButton(“X-Button”).pressed()) {
Collect = true;
HP.sizeX = HP.sizeX + 20;
}
}
if (Collect2 == false) {
HI.display2();
if (P1.xpos+20 >= bx && P1.ypos+65 >= by && P1.ypos <= by+20 && stick.getButton(“X-Button”).pressed()) {
Collect2 = true;
HP.sizeX = HP.sizeX + 50;
}
if (P1.xpos <= bx+20 && P1.ypos+65 >= by && P1.ypos <= by+20 && stick.getButton(“X-Button”).pressed()) {
Collect2 = true;
HP.sizeX = HP.sizeX + 50;
}
}
if (Collect3 == false) {
HI.display3();
if (P1.xpos+20 >= wx && P1.ypos+65 >= wy && P1.ypos <= wy+20 && stick.getButton(“X-Button”).pressed()) {
Collect3 = true;
HP.sizeX = HP.sizeX + 50;
}
if (P1.xpos <= wx+20 && P1.ypos+65 >= wy && P1.ypos <= wy+20 && stick.getButton(“X-Button”).pressed()) {
Collect3 = true;
HP.sizeX = HP.sizeX + 50;
}
}
if (Collect4 == false) {
HI.display4();
if (P1.xpos+20 >= vx && P1.ypos+65 >= vy && P1.ypos <= vy+20 && stick.getButton(“X-Button”).pressed()) {
Collect4 = true;
HP.sizeX = HP.sizeX + 50;
}
}
}
}


class Hot_Floor {
int x;
int y;
int nx;
int ny;
int wx;
int wy;
int bx;
int by;
int vx;
int vy;
boolean DontMove = false;
long animate;
color q = color(160, 100, 100);
int num = 5;
Hot_Floor() {
x = 2900;
y = 290;
nx = 3100;
ny = 290;
wx = 3100;
wy = 330;
bx = 3600;
by = 330;
vx = 3200;
vy = 330;
animate = millis();
}

void display() {
if (stick.getButton(“Home”).pressed()){
x = 2900;
y = 290;
nx = 3100;
ny = 290;
wx = 3100;
wy = 330;
bx = 3600;
by = 330;
vx = 3200;
vy = 330;
}
noStroke();
fill(q);
rect(x, y, 1400, 40);
noFill();
noStroke();
rect(wx, wy, 40, 40);
rect(vx, vy, 40, 40);
rect(vx + 100, vy, 40, 40);
rect(vx + 200, vy, 40, 40);
rect(vx + 300, vy, 40, 40);
rect(vx + 400, vy, 40, 40);
rect(bx, by, 10, 40);
numbersBack.setXY(nx, ny -150);
numbers[0].setXY(nx, ny -150);
numbers[1].setXY(nx, ny -150);
numbers[2].setXY(nx, ny -150);
numbers[3].setXY(nx, ny -150);
numbers[4].setXY(nx, ny -150);
numbers[5].setXY(nx, ny -150);
numbersBack.draw();
if (wx > wx – 1) {
if (wx + 40 < vx) {
numbers[0].draw();
}
if (wx + 40 > vx && wx + 40 < vx + 100) {
numbers[1].draw();
}
if (wx + 40 > vx + 100 && wx + 40 < vx + 200) {
numbers[2].draw();
}
if (wx + 40 > vx + 200 && wx + 40 < vx + 300) {
numbers[3].draw();
}
if (wx + 40 > vx + 300 && wx + 40 < vx + 400) {
numbers[4].draw();
}
if (skip == false) {
wx = wx + 2;
}
if (skip == true) {
wx = wx + 100;
}
q = color(160, 100, 100);
}
if (wx + 40 > bx && wx + 40 < bx + 10) {
q = color(255, 100, 100);
}
if (wx + 40 > bx) {
numbers[5].draw();
}
if (wx >= bx) {
wx = wx – 500;
}
if (P1Alive == true){
if (P1.walk == true) {
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos <= 600 && P1.ypos == 236) {
if (P1.skip == false) {
x = x – 8;
wx = wx – 8;
bx = bx – 8;
vx = vx – 8;

if (DontMove == false){
nx = nx – 8;
}
}
if (P1.skip == true) {
x = x – 18;
wx = wx – 18;
bx = bx – 18;
vx = vx – 18;

if (DontMove == false){
nx = nx – 18;
}
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= 0 && P1.ypos == 236) {
if (P1.skip == false) {
x = x + 8;
wx = wx + 8;
bx = bx + 8;
vx = vx + 8;
if (DontMove == false){
nx = nx + 8;
}
}
if (P1.skip == true) {
x = x + 18;
wx = wx + 18;
bx = bx + 18;
vx = vx + 18;
if (DontMove == false){
nx = nx + 18;
}
}
}
}
}
if (P1.climb1 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
vy = vy + 8;
if (DontMove == false){
ny = ny + 8;
}
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
vy = vy + 18;
if (DontMove == false){
ny = ny + 18;
}
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
vy = vy – 8;
if (DontMove == false){
ny = ny – 8;
}
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
vy = vy – 18;
if (DontMove == false){
ny = ny – 18;
}
}
}
}
}
if (P1.climb2 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
vy = vy + 8;
if (DontMove == false){
ny = ny + 8;
}
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
vy = vy + 18;
if (DontMove == false){
ny = ny + 18;
}
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
vy = vy – 8;
if (DontMove == false){
ny = ny – 8;
}
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
vy = vy – 18;
if (DontMove == false){
ny = ny – 18;
}
}
}
}
}
if (P1.climb3 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
vy = vy + 8;
if (DontMove == false){
ny = ny + 8;
}
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
vy = vy + 18;
if (DontMove == false){
ny = ny + 18;
}
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
vy = vy – 8;
if (DontMove == false){
ny = ny – 8;
}
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
vy = vy – 18;
if (DontMove == false){
ny = ny – 18;
}
}
}
}
}
if (P1.climb4 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
vy = vy + 8;
if (DontMove == false){
ny = ny + 8;
}
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
vy = vy + 18;
if (DontMove == false){
ny = ny + 18;
}
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
vy = vy – 8;
if (DontMove == false){
ny = ny – 8;
}
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
vy = vy – 18;
if (DontMove == false){
ny = ny – 18;
}
}
}
}
}
}
}
}


class Ladder {

int x;
int y;
int wx;
int wy;
int bx;
int by;
int vx;
int vy;

Ladder() {
x = 300;
y = 40;
wx = 1900;
wy = 0;
bx = 2000;
by = 236;
vx = 2900;
vy = 0;
}

void display() {
if (stick.getButton(“Home”).pressed()){
x = 300;
y = 40;
wx = 1900;
wy = 0;
bx = 2000;
by = 236;
vx = 2900;
vy = 0;
}
noStroke();
noFill();
rect(x, y, 40, 250);
ladder.setXY(x+20,y+112);
ladder.draw();
rect(wx, wy, 40, 300);
ladder2.setXY(wx+20,wy+152);
ladder2.draw();
rect(bx, by, 40, 300);
ladder3.setXY(bx+20,by+155);
ladder3.draw();
rect(vx, vy, 40, 300);
ladder4.setXY(vx+20,vy+152);
ladder4.draw();
if (P1Alive == true){
if (P1.walk == true) {
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos <= 600 && P1.ypos == 236) {
if (P1.skip == false) {
x = x – 8;
wx = wx – 8;
bx = bx – 8;
vx = vx – 8;
}
if (P1.skip == true) {
x = x – 18;
wx = wx – 18;
bx = bx – 18;
vx = vx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= 0 && P1.ypos == 236) {
if (P1.skip == false) {
x = x + 8;
wx = wx + 8;
bx = bx + 8;
vx = vx + 8;
}
if (P1.skip == true) {
x = x + 18;
wx = wx + 18;
bx = bx + 18;
vx = vx + 18;
}
}
}
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos + 30 <= 600 && P1.ypos <= 40) {
if (P1.skip == false) {
x = x – 8;
wx = wx – 8;
bx = bx – 8;
vx = vx – 8;
}
if (P1.skip == true) {
x = x – 18;
wx = wx – 18;
bx = bx – 18;
vx = vx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= LD.x && P1.ypos <= 40) {
if (P1.skip == false) {
x = x + 8;
wx = wx + 8;
bx = bx + 8;
vx = vx + 8;
}
if (P1.skip == true) {
x = x + 18;
wx = wx + 18;
bx = bx + 18;
vx = vx + 18;
}
}
}
}
if (P1.climb1 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
vy = vy + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
vy = vy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
vy = vy – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
vy = vy – 18;
}
}
}
}
if (P1.climb2 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
vy = vy + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
vy = vy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
vy = vy – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
vy = vy – 18;
}
}
}
}
if (P1.climb3 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
vy = vy + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
vy = vy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
vy = vy – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
vy = vy – 18;
}
}
}
}
if (P1.climb4 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
by = by + 8;
vy = vy + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
by = by + 18;
vy = vy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
by = by – 8;
vy = vy – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
by = by – 18;
vy = vy – 18;
}
}
}
}
}
}
}


class Lazer {

int x;
int wx;
int vx;
int y;
int wy;
int vy;
boolean trap = false;
boolean left = true;
boolean right = false;

Lazer() {
x = 894;
vx = 894;
wx = 895;
y = -100;
vy = -100;
wy = 0;
}

void display() {
if (stick.getButton(“Home”).pressed()){
x = 894;
wx = 895;
y = -100;
wy = 0;
}
noFill();
stroke(255, 0, 0);
rect(x, y, 5, 400);
rect(x +500, y, 5, 400);
rect(vx +500, vy, 5, 400);
rect(vx +3000, vy, 5, 400);
rect(vx +2000, vy, 5, 160);
if (x < wx+380 && x < wx) {
left = false;
right = true;
}
if (x > wx && x > wx+380) {
left = true;
right = false;
}
if (left == true) {
x = x – 1;
vx = vx + 1;
if (skip == true) {
x = x – 5;
vx = vx + 5;
}
}
if (right == true) {
x = x + 1;
vx = vx – 1;
if (skip == true) {
x = x + 5;
vx = vx – 5;
}
}
if (P1Alive == true){
if (P1.walk == true){
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos <= 600 && P1.ypos == 236) {
if (P1.skip == false) {
x = x – 8;
wx = wx – 8;
vx = vx – 8;
}
if (P1.skip == true) {
x = x – 18;
wx = wx – 18;
vx = vx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= 0 && P1.ypos == 236) {
if (P1.skip == false) {
x = x + 8;
wx = wx + 8;
vx = vx + 8;
}
if (P1.skip == true) {
x = x + 18;
wx = wx + 18;
vx = vx + 18;
}
}
}
if (worldScrollR == true) {
if (stick.getButton(“D-Right”).pressed()&& P1.xpos + 30 <= 600 && P1.ypos <= 40) {
if (P1.skip == false) {
x = x – 8;
wx = wx – 8;
vx = vx – 8;
}
if (P1.skip == true) {
x = x – 18;
wx = wx – 18;
vx = vx – 18;
}
}
}
if (worldScrollL == true) {
if (stick.getButton(“D-Left”).pressed()&& P1.xpos >= G1.x – 40 && P1.ypos <= 40) {
if (P1.skip == false) {
x = x + 8;
wx = wx + 8;
vx = vx + 8;
}
if (P1.skip == true) {
x = x + 18;
wx = wx + 18;
vx = vx + 18;
}
}
}
}
if (P1.climb1 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
vy = vy + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
vy = vy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
vy = vy – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
vy = vy – 18;
}
}
}
}
if (P1.climb2 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
vy = vy + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
vy = vy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
vy = vy – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
vy = vy – 18;
}
}
}
}
if (P1.climb3 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
vy = vy + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
vy = vy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
vy = vy – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
vy = vy – 18;
}
}
}
}
if (P1.climb4 == true) {
if (worldScrollU == true) {
if (stick.getButton(“D-Up”).pressed()) {
if (P1.skip == false) {
y = y + 8;
wy = wy + 8;
vy = vy + 8;
}
if (P1.skip == true) {
y = y + 18;
wy = wy + 18;
vy = vy + 18;
}
}
}
if (worldScrollD == true) {
if (stick.getButton(“D-Down”).pressed()) {
if (P1.skip == false) {
y = y – 8;
wy = wy – 8;
vy = vy – 8;
}
if (P1.skip == true) {
y = y – 18;
wy = wy – 18;
vy = vy – 18;
}
}
}
}
}
}
void hitbox() {
noFill();
noStroke();
rect(wx, wy, 380, 300);
rect(wx +500, wy, 380, 300);
}
}


class Player {
color c;

int anim = 3;

float xpos;
float ypos;
float sxpos;
float sypos;
float fxpos;
float fypos;
float spritex;
float spritey;
float P1xpos;
float xspeed;
float animation = 1000;

long animate;

boolean R = true;
boolean L = false;
boolean Idol = true;
boolean attack = false;
boolean skip = false;
boolean pushable;
boolean climb1 = false;
boolean climb2 = false;
boolean climb3 = false;
boolean climb4 = false;
boolean ScrollR = false;
boolean ScrollL = false;
boolean ScrollU = false;
boolean ScrollD = false;
boolean walk = true;
boolean wall = false;
boolean wall2 = false;
boolean wall3 = false;
boolean wall4 = false;
boolean wall5 = false;
boolean wall6 = false;
boolean wall7 = false;
boolean wall8 = false;
boolean Trap = false;
boolean TrapWall = false;

Player() {
c = color(255);
xpos = 115;
ypos = 236;
sxpos = 115;
sypos = 236;
fxpos = 136;
fypos = 250;
spritex = 130;
spritey = 268;
xspeed = 1;
animate = millis();
}

void display() {
if (stick.getButton(“Home”).pressed()){
xpos = 115;
ypos = 236;
sxpos = 115;
sypos = 236;
fxpos = 136;
fypos = 250;
spritex = 130;
spritey = 268;
}
noStroke();
noFill();
rect(xpos, ypos, 30, 65);
playerRight.setXY(spritex, spritey);
playerWRight[0].setXY(spritex, spritey);
playerWRight[1].setXY(spritex, spritey);
playerWRight[2].setXY(spritex, spritey);
playerWRight[3].setXY(spritex, spritey);
playerPRight.setXY(spritex, spritey);
playerIRight.setXY(spritex, spritey);
playerSRight.setXY(spritex, spritey);
playerDRight.setXY(spritex, spritey);
playerLeft.setXY(spritex, spritey);
playerWLeft[0].setXY(spritex, spritey);
playerWLeft[1].setXY(spritex, spritey);
playerWLeft[2].setXY(spritex, spritey);
playerWLeft[3].setXY(spritex, spritey);
playerPLeft.setXY(spritex, spritey);
playerILeft.setXY(spritex, spritey);
playerClimb[0].setXY(spritex, spritey);
playerClimb[1].setXY(spritex, spritey);
playerClimb[2].setXY(spritex, spritey);
playerClimb[3].setXY(spritex, spritey);
if (Idol == true) {
if (R == true) {
playerRight.draw();
if (attack == false) {
playerIRight.draw();
}
if (attack == true) {
playerPRight.draw();
}
}
if (L == true) {
playerLeft.draw();
if (attack == false) {
playerILeft.draw();
}
if (attack == true) {
playerPLeft.draw();
}
}
if (climb1 == true && ypos + 65 < LD.y +300 && !stick.getButton(“D-Up”).pressed() && !stick.getButton(“D-Down”).pressed()) {
R = false;
L = false;
playerClimb[0].draw();
}
if (climb2 == true && ypos + 65 < LD.y +300 && !stick.getButton(“D-Up”).pressed() && !stick.getButton(“D-Down”).pressed()) {
R = false;
L = false;
playerClimb[0].draw();
}
if (climb3 == true && !stick.getButton(“D-Up”).pressed() && !stick.getButton(“D-Down”).pressed()) {
R = false;
L = false;
playerClimb[0].draw();
}
if (climb4 == true && ypos + 65 < LD.y +300 && !stick.getButton(“D-Up”).pressed() && !stick.getButton(“D-Down”).pressed()) {
R = false;
L = false;
playerClimb[0].draw();
}
}
if (Idol == false) {
if (R == true) {
anim ++;
if (anim > 3) {
anim = 0;
}
playerWRight[anim].draw();
}
if (L == true) {
anim ++;
if (anim > 3) {
anim = 0;
}
playerWLeft[anim].draw();
}
}
}
void skip() {
if (skip == false) {
P1.display();
P1.hitbox();
}
if (skip == true) {
if (frame == 0) {

background(255, 150, 150);
stroke(255, 0, 0);
noFill();
rect(sxpos, sypos, 30, 65);
playerSRight.draw();
if (millis() – timer > framespeed) {
cooldown = true;
if (cooldown == true) {
timer = millis();
frame += 1;
}
}
} else if (frame == numFrames) {
frame = 0;
skip = false;
} else {
//if (frame == 1) {
// skip = false;
// }
frame ++;
}
}
}

public void control() {
getUserInput();
//Player v. Hot Floor
if (xpos + 30 > HF.x + 200 && xpos < HF.x + 1240) {
HF.DontMove = true;
} else {
HF.DontMove = false;
}
if (xpos + 30 > HF.x + 50 && xpos < HF.x + 1400 && HF.wx + 40 > HF.bx && HF.wx + 40 < HF.bx + 10 && ypos < HF.y +40) {
if (skip == false) {
HP.sizeX = HP.sizeX – 20;
}
}
//Player v. Win thing
if (xpos + 30 > GO.x && xpos < GO.x && ypos < GO.y + 10 && ypos + 65 > GO.y){
win = true;
}
//Player v. Enemy
if (xpos + 30 > E1.x && ypos > E1.wy && ypos + 65 < E1.wy + 150){
E1.Ded = true;
}
if (xpos + 30 > E1.wx && ypos > E1.wy && ypos + 65 < E1.wy + 150) {
E1.EAttk = true;
Trap = true;
if (E1.EAttk == true) {
if (G1.Trap < 180) {
G1.Trap = G1.Trap +20;
}
}
}
if (E1.bx < xpos) {
Trap = false;
if (G1.Trap > 0) {
G1.Trap = G1.Trap – 20;
}
}
if (E1.bx < xpos + 30 && E1.bx + 10 > xpos && E1.by > ypos && E1.by+10 < ypos + 65 && skip == false) {
HP.sizeX = HP.sizeX – 30;
}
//Player touch lazer
if (LZ.x+5 > xpos && LZ.x < xpos+30 && ypos > LZ.y && ypos + 65 <= LZ.y + 410) {
if (skip == false) {
HP.sizeX = HP.sizeX – 10;
}
}
if (LZ.x+505 > xpos && LZ.x+500 < xpos+30 && ypos > LZ.y && ypos + 65 <= LZ.y + 410) {
if (skip == false) {
HP.sizeX = HP.sizeX – 10;
}
}
if (LZ.vx+505 > xpos && LZ.vx+500 < xpos+30 && ypos > LZ.vy && ypos + 65 <= LZ.vy + 410) {
if (skip == false) {
HP.sizeX = HP.sizeX – 10;
}
}
if (LZ.vx+3005 > xpos && LZ.vx+3000 < xpos+30 && ypos > LZ.vy && ypos + 65 <= LZ.vy + 410) {
if (skip == false) {
HP.sizeX = HP.sizeX – 10;
}
}
if (LZ.vx+2005 > xpos && LZ.vx+2000 < xpos+30 && ypos > LZ.vy && ypos + 65 <= LZ.vy + 170) {
if (skip == false) {
HP.sizeX = HP.sizeX – 10;
}
}
//Player touch wall
if (G1.Trapy <= ypos && G1.Trapy + 250 >= ypos + 65 && xpos < G1.Trapx + 40 && Trap == true) {
ScrollL = false;
worldScrollL = false;
TrapWall = true;
} else {
TrapWall = false;
}
if (G1.wy <= ypos && G1.wy + 250 >= ypos + 65 && xpos + 30 > G1.wx) {
ScrollR = false;
worldScrollR = false;
wall = true;
} else {
wall = false;
}
if (xpos > G1.wx + 40) {
wall = false;
}
if (G1.vy <= ypos && G1.vy + 250 >= ypos + 65 && xpos + 30 > G1.vx) {
ScrollR = false;
worldScrollR = false;
wall3 = true;
} else {
wall3 = false;
}
if (xpos <= G1.wx -900) {
ScrollL = false;
worldScrollL = false;
wall8 = true;
} else {
wall8 = false;
}
if (xpos + 30 > G1.wx + 3440) {
ScrollR = false;
worldScrollR = false;
wall6 = true;
} else {
wall6 = false;
}
//Player touch button
if (xpos + 30 > BU.x -20 && ypos <= LD.y) {
door1 = false;
}
if (xpos + 30 > BU.wx && ypos + 65 >= LD.by + 200) {
door2 = false;
if (G1.Trap > 0) {
G1.Trap = G1.Trap – 20;
}
}
if (xpos + 30 > BU.bx -20 && ypos <= LD.by) {
door3 = false;
}
//Player touch closed door
if (G1.dy <= ypos && G1.dy + 210 >= ypos + 65 && xpos + 30 > G1.dx && door1 == true) {
ScrollR = false;
worldScrollR = false;
wall2 = true;
} else {
wall2 = false;
}
if (G1.ddy <= ypos && G1.ddy + 210 >= ypos + 65 && xpos + 30 > G1.ddx && xpos < G1.ddx && door2 == true) {
ScrollR = false;
worldScrollR = false;
wall4 = true;
} else {
wall4 = false;
}
if (G1.dddy <= ypos && G1.dddy + 210 >= ypos + 65 && xpos + 30 > G1.dddx && xpos < G1.dddx && door3 == true) {
ScrollR = false;
worldScrollR = false;
wall5 = true;
} else {
wall5 = false;
}
if (xpos + 30 > G1.wx + 2000 && xpos < G1.wx + 2000 && ypos + 65 > LD.wy + 200 && ypos < LD.wy + 300) {
ScrollR = false;
worldScrollR = false;
wall7 = true;
} else {
wall7 = false;
}

//Walking
if (walk == true) {
if (stick.getButton(“D-Right”).pressed()&& xpos <= 600 && ypos == 236) {
if (skip == false) {
if (wall == false) {
if (wall2 == false) {
if (wall3 == false) {
if (wall4 == false) {
if (wall5 == false) {
if (wall6 == false) {
if (wall7 == false) {
ScrollR = true;
worldScrollR = true;
}
}
}
}
}
}
}
}
if (skip == true) {
if (wall == false) {
if (wall2 == false) {
if (wall3 == false) {
if (wall4 == false) {
if (wall5 == false) {
if (wall6 == false) {
if (wall7 == false) {
ScrollR = true;
worldScrollR = true;
}
}
}
}
}
}
}
}
L = false;
R = true;
Idol = false;
}

if (stick.getButton(“D-Left”).pressed()&& xpos >= 0 && ypos == 236) {

if (skip == false) {
if (TrapWall == false) {
if (wall8 == false) {
ScrollL = true;
worldScrollL = true;
}
}
}
if (skip == true) {
if (TrapWall == false) {
if (wall8 == false) {
ScrollL = true;
worldScrollL = true;
}
}
}
L = true;
R = false;
Idol = false;
} else if (!stick.getButton(“D-Right”).pressed()&&!stick.getButton(“D-Left”).pressed()) {
Idol = true;
}
}
if (!stick.getButton(“X-Button”).pressed()) {
attack = false;
}
//Skip ability
if (stick.getButton(“B-Button”).pressed() && pushable == true) {
skip = true;
pushable = false;
} else if (!stick.getButton(“B-Button”).pressed()) {
pushable = true;
}
//Climbing
if (xpos+20 >= LD.x && xpos <= LD.x+40) {
climb1 = true;
}
if (xpos+20 <= LD.x) {
climb1 = false;
}
if (xpos >= LD.x+40) {
climb1 = false;
}
if (xpos+20 >= LD.wx && xpos <= LD.wx+40) {
climb2 = true;
}
if (xpos+20 <= LD.wx) {
climb2 = false;
}
if (xpos >= LD.wx+40) {
climb2 = false;
}
if (xpos+20 >= LD.bx && xpos <= LD.bx+40) {
climb3 = true;
}
if (xpos+20 <= LD.bx) {
climb3 = false;
}
if (xpos >= LD.bx+40) {
climb3= false;
}
if (xpos+20 >= LD.vx && xpos <= LD.vx+40) {
climb4 = true;
}
if (xpos+20 <= LD.vx) {
climb4 = false;
}
if (xpos >= LD.vx+40) {
climb4= false;
}
if (climb1 == true) {
if (L == true) {
L = true;
R = false;
}
if (R == true) {
R = true;
L = false;
}
if (stick.getButton(“D-Up”).pressed()) {
anim ++;
if (anim > 3) {
anim = 0;
}
playerClimb[anim].draw();
ScrollU = true;
worldScrollU = true;
walk = false;
L = false;
R = false;
}

if (ypos <= LD.y) {
ScrollU = false;
worldScrollU = false;
walk = true;
if (xpos <= LD.x) {
worldScrollL = false;
}
}
if (stick.getButton(“D-Down”).pressed()) {
anim ++;
if (anim > 3) {
anim = 0;
}
playerClimb[anim].draw();
ScrollD = true;
worldScrollD = true;
walk = false;
L = false;
R = false;
}
if (ypos + 65 >= LD.y + 255) {
ScrollD = false;
worldScrollD = false;
walk = true;
}
}
if (climb2 == true) {
if (stick.getButton(“D-Up”).pressed()) {
anim ++;
if (anim > 3) {
anim = 0;
}
playerClimb[anim].draw();
ScrollU = true;
worldScrollU = true;
walk = false;
L = false;
R = false;
}
if (ypos <= LD.wy) {
ScrollU = false;
worldScrollU = false;
walk = true;
if (xpos <= LD.wx) {
worldScrollL = false;
}
}
if (stick.getButton(“D-Down”).pressed()) {
anim ++;
if (anim > 3) {
anim = 0;
}
playerClimb[anim].draw();
ScrollD = true;
worldScrollD = true;
walk = false;
L = false;
R = false;
}
if (ypos + 65 >= LD.wy + 300) {
ScrollD = false;
worldScrollD = false;
walk = true;
}
}
if (climb3 == true) {
if (stick.getButton(“D-Up”).pressed()) {
anim ++;
if (anim > 3) {
anim = 0;
}
playerClimb[anim].draw();
ScrollU = true;
worldScrollU = true;
walk = false;
L = false;
R = false;
}
if (ypos <= LD.by) {
ScrollU = false;
worldScrollU = false;
walk = true;
}
if (stick.getButton(“D-Down”).pressed()) {
anim ++;
if (anim > 3) {
anim = 0;
}
playerClimb[anim].draw();
ScrollD = true;
worldScrollD = true;
walk = false;
L = false;
R = false;
}
if (ypos + 65 >= LD.by + 305) {
ScrollD = false;
worldScrollD = false;
walk = true;
if (xpos < LD.bx) {
worldScrollL = false;
}
}
if (ypos + 65 <= LD.by) {
worldScrollD = false;
}
}
if (climb4 == true) {
if (stick.getButton(“D-Up”).pressed()) {
anim ++;
if (anim > 3) {
anim = 0;
}
playerClimb[anim].draw();
ScrollU = true;
worldScrollU = true;
walk = false;
L = false;
R = false;
}
if (ypos <= LD.vy) {
ScrollU = false;
worldScrollU = false;
walk = true;
if (xpos + 30 > LD.vx + 40) {
worldScrollR = false;
}
}
if (stick.getButton(“D-Down”).pressed()) {
anim ++;
if (anim > 3) {
anim = 0;
}
playerClimb[anim].draw();
ScrollD = true;
worldScrollD = true;
walk = false;
L = false;
R = false;
}
if (ypos + 65 >= LD.vy + 300) {
ScrollD = false;
worldScrollD = false;
walk = true;
if (xpos < LD.vx) {
worldScrollL = false;
worldScrollR = true;
}
}
if (ypos > LD.vy + 305) {
climb4 = false;
walk = true;
worldScrollL = true;
}
}
}
void attack() {
attack = true;
noFill();
stroke(255, 0, 0);
if (R == true) {
rect(fxpos, fypos, 20, 20);
}
if (L == true) {
rect(fxpos-34, fypos, 20, 20);
}
}
void fall() {
ypos = ypos + 10;
spritey = spritey + 10;
}
void hitbox() {
noStroke();
noFill();
rect(xpos, ypos, 30, 65);
}
}

Advertisements
This entry was posted in Best Work, Interactive Authoring, Research, Time-Based and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s