Casme Alpha Recording

 

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

Minim minim;
AudioPlayer Aplayer;
AudioInput input;
AudioPlayer song1;
AudioPlayer song2;
BeatDetect beat;

//make the keys needed to procede through each level
//draw character and enemy sprites
//draw backgrounds and title screens
//make dialogue and cutscenes
//WRITE DIALOGUE

import game2dai.*;
import game2dai.entities.*;
import game2dai.entityshapes.*;
import game2dai.entityshapes.ps.*;
import game2dai.fsm.*;
import game2dai.graph.*;
import game2dai.maths.*;
import game2dai.steering.*;
import game2dai.utils.*;

import net.java.games.input.*;
import org.gamecontrolplus.*;
import org.gamecontrolplus.gui.*;
ControlIO control;
ControlDevice stick;
Collider[] Door;
Collider key1, key2, key3, player;
float speed=0;
float Px;
float Py;
float health=4;
int room;
int keyCount;
int gameover;
boolean collected1,collected2,collected3;
boolean DEAD;
boolean Collision;
PImage photo, photo2, photo3, photo4, DEADED, KEY;
//boolean invincible;

public void setup() {
size (720, 450);
surface.setResizable(false);
background (189,240,151);
minim = new Minim(this);
photo=loadImage(“Casmeforward1.png”);
photo2=loadImage(“Casmeright1.png”);
photo3=loadImage(“Casmeleft1.png”);
photo4=loadImage(“Casmebackone.png”);
DEADED=loadImage(“DEADED.png”);
KEY=loadImage(“Key.png”);
control = ControlIO.getInstance(this);
stick = control.getMatchedDevice(“gametime”);
player= new Collider(300, 300, 50, 50);
key1= new Collider (width/2, height/2, 50, 20);
key2= new Collider (width/2, height/2, 50, 20);
key3= new Collider (width/2, height/2, 50, 20);
Door= new Collider [17];
for (int i=0; i<17; i= i+1) {
if (i==0||i==9||i==11||i==13||i==16) { //A doors
Door[i]=new Collider(10, height/2, 25, 60);
} else if (i==3||i==5||i==14) {//B doors
Door[i]=new Collider(width/2, 10, 70, 50);
} else if (i==2||i==4||i==8||i==10||i==15) {//C doors
Door[i]=new Collider(width, height/2, 25, 60);
} else if (i==6||i==7||i==12) {//D doors
Door[i]=new Collider(width/2, height, 70, 50);
} else {//Final Door
Door[i]=new Collider(width/2, 10, 80, 25);
}
}
//for (int i=0; i<30; i=i+1) {
// if (i==0||i==1||i==2||i==3||i==4||i==5||i==6||i==7||i==8||i==9) {//green snakes
// enemy[i]= new Collider (random(Px),random(Py)+obspeed,10, 30);
// } else if (i==10||i==11||i==12||i==13||i==14||i==15||i==16||i==17||i==18||i==19) {
// enemy[i]= new Collider (random(Px)+boostspeed, random(Py), 30, 10);
// } else if (i==20||i==21||i==22||i==23||i==24||i==25||i==26||i==27||i==28||i==29) {
// enemy[i]= new Collider (random(Px)+dblspeed, random(Py), 30, 10);
// }
//}
room=1;
keyCount=0;
DEAD=false;
song1 = minim.loadFile(“party in the clouds.mp3”, 600);
song1.play();
}
boolean checkDetect (Collider a, Collider b) {
boolean collide = false;
if (b.location.x > a.location.x && b.location.x < a.location.x+a.size.x) {
if (b.location.y > a.location.y && b.location.y < a.location.y+a.size.y) {
println(“Collision Detected”);
collide = true;
}
}
return collide;
}

void update() {
//checkDetect(player, enemy[1]);
//if (Collider [0].location.x >= width){
// Collider [0].location.x=width;
//}
//if (Collider [0].location.y >= height){
// Collider [0].location.y=height;
//}
if (player.location.x > width) {
player.location.x=width;
}
if (player.location.y > height) {
player.location.y=height;
}
if (player.location.x <=0) {
player.location.x=0;
}
if (player.location.y <= 0) {
player.location.y=0;
}

}

void draw() {
update();
background (143,203,102);
noFill();
imageMode(CENTER);
image(photo4,player.location.x,player.location.y);
rectMode(CENTER);
rect (player.location.x , player.location.y,player.size.x ,player.size.y );//character
health=4;

if (stick.getButton(“Dup”).pressed()){
imageMode(CENTER);
image(photo4,player.location.x,player.location.y);
player.location.y -= 5+speed;
//Casme=photo4;
}
if (stick.getButton(“Ddown”).pressed()) {
//imageMode(CENTER);
image(photo,player.location.x,player.location.y);
player.location.y += 5+speed;
}
if (stick.getButton(“Dleft”).pressed()) {
//imageMode(CENTER);
image(photo3,player.location.x,player.location.y);
player.location.x -= 5+speed;
}
if (stick.getButton(“Dright”).pressed()) {
imageMode(CENTER);
image(photo2,player.location.x,player.location.y);
player.location.x += 5+speed;
}

//fill (255, 0, 10);
//ellipse (Collider[1].location.x, Collider[1].location.y, 10, 10);
//Collider[1].location.x+=obspeed;
//if (Collider[1].location.x>=605) {
// Collider[1].location.x=0;
//}
if (room==1) {
noStroke();
ellipseMode(CENTER);
fill(163,233,112);
ellipse(Door[0].location.x, Door[0].location.y, Door[0].size.x, Door[0].size.y);
ellipseMode(CENTER);
ellipse(Door[2].location.x-10, Door[2].location.y, Door[2].size.x, Door[2].size.y);
fill(255, 250, 0);
ellipseMode(CENTER);
ellipse(Door[1].location.x, Door[1].location.y, Door[1].size.x, Door[1].size.y);
fill(200,0,255);
textSize(15);
text(“Morning Casme, your friend Rasa is here! Looks like you’ve lost me again.”, 25, 50);
text(“I know what youre thinking, “Why can I hear his voice?” “, 50, 75);
text(“Well, shut up! You’ll find out once you open the gate in front of you.”, 75, 100);
text (“Find the three keys to unlock it… I’ll be waiting!”, 100, 125);

if (stick.getButton(“aButton”).pressed()) {
if (checkDetect(player, Door[0])) {
player.location.x=Door[4].location.x;
player.location.y=Door[4].location.y;
room=2;
} else if (checkDetect(player, Door[2])) {
player.location.x=Door[13].location.x;
player.location.y=Door[13].location.y;
room=7;
}else if (checkDetect(player, Door[1])) {
if (collected1==true&& collected2==true&&collected3==true){
DEAD=true;
}
}
}
} else if (room==2) {
noStroke();
fill(163,233,112);
ellipseMode(CENTER);
ellipse(Door[3].location.x, Door[3].location.y, Door[3].size.x, Door[3].size.y);
ellipseMode(CENTER);
ellipse(Door[4].location.x-10, Door[4].location.y, Door[4].size.x, Door[4].size.y);
fill(200,0,255);
text(“This neck of the woods hasn’t been explored in a while,”, 25, 50);
text(“I wonder if this time will end as tragically as the first!”, 50, 75);
fill(0);
if (stick.getButton(“aButton”).pressed()) {
if (checkDetect(player, Door[3])) {
player.location.x=Door[6].location.x;
player.location.y=Door[6].location.y;
room=3;
} else if (checkDetect(player, Door[4])) {
player.location.x=Door[0].location.x;
player.location.y=Door[0].location.y;
room=1;
}
}
} else if (room==3) {
noStroke();
fill(163,233,112);
ellipseMode(CENTER);
ellipse(Door[6].location.x, Door[6].location.y, Door[6].size.x, Door[6].size.y);
ellipseMode(CENTER);
ellipse(Door[5].location.x, Door[5].location.y, Door[5].size.x, Door[5].size.y);

if (checkDetect(player, key1)){
keyCount=+1;
collected1=true;
println(“key1 collected”);
}

if (collected1==false){
imageMode(CENTER);
image(KEY,key1.location.x,key1.location.y);
noFill();
rectMode(CENTER);
rect(key1.location.x, key1.location.y, key1.size.x, key1.size.y);
}

fill(200,0,255);
text(“Hey there’s one of the Keys! Go grab it so you can get to me!”, 25, 50);
if (stick.getButton(“aButton”).pressed()) {
if (checkDetect(player, Door[6])) {
player.location.x=Door[3].location.x;
player.location.y=Door[3].location.y;
room=2;
} else if (checkDetect(player, Door[5])) {
player.location.x=Door[7].location.x;
player.location.y=Door[7].location.y;
room=4;
}
}
} else if (room==4) {
noStroke();
fill(163,233,112);
ellipseMode(CENTER);
ellipse(Door[7].location.x, Door[7].location.y, Door[7].size.x, Door[7].size.y);
ellipseMode(CENTER);
ellipse(Door[8].location.x-10, Door[8].location.y, Door[8].size.x, Door[8].size.y);
fill(200,0,255);
text (“I remember another girl I met once, I think her name was Evie or Ellen?”, 25, 50);
text (“Ah who cares she’s dead now. Dad gave up on her and that other boy a long time ago”, 50, 75);
if (stick.getButton(“aButton”).pressed()) {
if (checkDetect(player, Door[7])) {
player.location.x=Door[5].location.x;
player.location.y=Door[5].location.y;
room=3;
} else if (checkDetect(player, Door[8])) {
player.location.x=Door[9].location.x;
player.location.y=Door[9].location.y;
room=5;
}
}
} else if (room==5) {
noStroke();
fill(163,233,112);
ellipseMode(CENTER);
ellipse(Door[9].location.x, Door[9].location.y, Door[9].size.x, Door[9].size.y);
ellipseMode(CENTER);
ellipse(Door[10].location.x-10, Door[10].location.y, Door[10].size.x, Door[10].size.y);
fill(200, 20, 20);
text (“I wonder how Rasa even got here.”, 25, 50);
text (“I’ve never been in this part of the woods before, so I couldn’t have left him.”, 50, 75);
if (stick.getButton(“aButton”).pressed()) {
if (checkDetect(player, Door[9])) {
player.location.x=Door[8].location.x;
player.location.y=Door[8].location.y;
room=4;
} else if (checkDetect(player, Door[10])) {
player.location.x=Door[11].location.x;
player.location.y=Door[11].location.y;
room=6;
}
}
} else if (room==6) {
noStroke();
fill(163,233,112);
ellipseMode(CENTER);
ellipse(Door[11].location.x, Door[11].location.y, Door[11].size.x, Door[11].size.y);
ellipseMode(CENTER);
ellipse(Door[12].location.x, Door[12].location.y-10, Door[12].size.x, Door[12].size.y);
if (checkDetect(player, key2)){
keyCount=+1;
collected2=true;
println(“key2 collected”);
}
if (collected2==false){
imageMode(CENTER);
image(KEY,key2.location.x,key2.location.y);
noFill();
rectMode(CENTER);
rect(key2.location.x, key2.location.y, key2.size.x, key2.size.y);
}

fill(0,0,155);
text(“What are you doing Child? Don’t listen to his Honeyed words!”,25,50);
text(“Get rid of the Keys!”,50,75);

fill(0);
if (stick.getButton(“aButton”).pressed()) {
if (checkDetect(player, Door[11])) {
player.location.x=Door[10].location.x;
player.location.y=Door[10].location.y;
room=5;
} else if (checkDetect(player, Door[12])) {
player.location.x=Door[14].location.x;
player.location.y=Door[14].location.y;
room=7;
}
}
} else if (room==7) {
noStroke();
fill(163,233,112);
ellipseMode(CENTER);
ellipse(Door[14].location.x, Door[14].location.y, Door[14].size.x, Door[14].size.y);
ellipseMode(CENTER);
ellipse(Door[13].location.x, Door[13].location.y, Door[13].size.x, Door[13].size.y);
ellipseMode(CENTER);
ellipse(Door[15].location.x-10, Door[15].location.y, Door[15].size.x, Door[15].size.y);
fill(200,0,255);
text (“People claim to hate me usually. They think I’m “untrustworthy”, and a “narcisissist””,25,50);
text (“Me?! A Narcissist?!, can you believe it?!”,50,75);
if (stick.getButton(“aButton”).pressed()) {
if (checkDetect(player, Door[14])) {
player.location.x=Door[12].location.x;
player.location.y=Door[12].location.y;
room=6;
} else if (checkDetect(player, Door[13])) {
player.location.x=Door[2].location.x;
player.location.y=Door[2].location.y;
room=1;
} else if (checkDetect(player, Door[15])) {
player.location.x=Door[16].location.x;
player.location.y=Door[16].location.y;
room=8;
}
}
} else if (room==8) {
noStroke();
fill(163,233,112);
ellipseMode(CENTER);
ellipse(Door[16].location.x-10, Door[16].location.y, Door[16].size.x, Door[16].size.y);
stroke(255);

if (checkDetect(player, key3)){
keyCount=+1;
collected3=true;
println(“key3 collected”);
}
if (collected3==false){
imageMode(CENTER);
image(KEY,key3.location.x,key3.location.y);
noFill();
noStroke();
rectMode(CENTER);
rect(key3.location.x, key3.location.y, key3.size.x, key3.size.y);
}
noFill();
noStroke();
rectMode(CENTER);
rect(key3.location.x, key3.location.y, key3.size.x, key3.size.y);
fill(200, 20, 20);
text(“This is weird. The keys are giving off a really creepy feeling.”,25,50);
text(“Is this a good idea? Maybe I should do as that voice said…”,50,75);
if (stick.getButton(“aButton”).pressed()) {
checkDetect(player, Door[16]);
if (checkDetect(player, Door[16])) {
player.location.x=Door[15].location.x;
player.location.y=Door[15].location.y;
room=7;
}
}
}
if (DEAD== true){
//song1 = minim.loadFile(“party in the clouds.mp3”, 600);
//song1.pause();

//song2 = minim.loadFile(“farewell.mp3”, 600);
//song2.play();
imageMode(CORNER);
image(DEADED,0,0);
}
}

 

Advertisements
This entry was posted in Non-Time Based, Research 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