Casme

https://vimeo.com/194874001

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

//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[] enemy;
Collider player;
Collider[] Door;
Collider keys;
float speed=0;
float obspeed=5;
float boostspeed=7;
float dblspeed=10;
float Px;
float Py;
float health=4;
int room;
int keyCount;
boolean collected;
boolean unlocked;
boolean cutscene;
boolean Collision;
//boolean invincible;

Sprite Casme;

public void setup() {
size (1440, 900);
surface.setResizable(false);
background (0);
Casme = new Sprite(this, “Casmeforward1.png”, 10);
//Casme[1] = new Sprite(this, “Casmeforward1.png”,10);
control = ControlIO.getInstance(this);
stick = control.getMatchedDevice(“gametime”);
player= new Collider(300, 300, 40, 40);
keys= new Collider (width/2, height/2, 50, 20);
enemy= new Collider[30];
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-30, height/2, 25, 60);
} else if (i==6||i==7||i==12) {//D doors
Door[i]=new Collider(width/2, height-70, 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;
}
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-25) {
player.location.x=width-25;
}
if (player.location.y > height-70) {
player.location.y=height-70;
}
if (player.location.x <=0) {
player.location.x=0;
}
if (player.location.y <= 0) {
player.location.y=0;
}
if (checkDetect(player, keys));
keyCount=+1;
collected=true;
}

void draw() {
update();
background (255);
fill (0);
rectMode(CENTER);
Casme.setXY(player.location.x, player.location.y);
Casme.draw();
S4P.drawSprites();
rectMode(CENTER);
rect (player.location.x, player.location.y, 25, 25);//character
health=4;

if (stick.getButton(“Dup”).pressed()) {
player.location.y -= 5+speed;
}
if (stick.getButton(“Ddown”).pressed()) {
player.location.y += 5+speed;
}
if (stick.getButton(“Dleft”).pressed()) {
player.location.x -= 5+speed;
}
if (stick.getButton(“Dright”).pressed()) {
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) {
fill(0);
rect(Door[0].location.x, Door[0].location.y, Door[0].size.x, Door[0].size.y);
rect(Door[2].location.x-10, Door[2].location.y, Door[2].size.x, Door[2].size.y);
fill(255, 250, 0);
rect(Door[1].location.x, Door[1].location.y, Door[1].size.x, Door[1].size.y);
fill(200,0,255);
textSize(20);
text(“Morning Casme, your friend Rasa is here! Looks like you’ve lost me again.”, 50, 150);
text(“I know what youre thinking, “Why can I hear his voice?” “, 100, 200);
text(“Well, shut up! You’ll find out once you open the gate in front of you.”, 150, 250);
text (“Find the three keys to unlock it… I’ll be waiting!”, 200, 300);

text(“1”, 50, 50);
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 (room==2) {
rect(Door[3].location.x, Door[3].location.y, Door[3].size.x, Door[3].size.y);
rect(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,”, 100, 100);
text(“I wonder if the last time ended as dramatically as the first!”, 150, 150);
fill(0);
text(“2”, 5, 5);
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) {
rect(Door[6].location.x, Door[6].location.y, Door[6].size.x, Door[6].size.y);
rect(Door[5].location.x, Door[5].location.y, Door[5].size.x, Door[5].size.y);

rect(keys.location.x, keys.location.y, keys.size.x, keys.size.y);

fill(200,0,255);
text(“Hey there’s one of the Keys! Go grab it so you can get to me!”, 100, 100);
text(“3”, 50, 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) {
rect(Door[7].location.x, Door[7].location.y, Door[7].size.x, Door[7].size.y);
rect(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?”, 100, 100);
text (“Ah who cares she’s dead now. Dad gave up on her and that other boy a long time ago”, 150, 150);

text(“4”, 300, 300);
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) {
rect(Door[9].location.x, Door[9].location.y, Door[9].size.x, Door[9].size.y);
rect(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.”, 100, 100);
text (“I’ve never been in this part of the woods before, so I couldn’t have left him.”, 150, 150);
text(“5”, 300, 300);
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) {
rect(Door[11].location.x, Door[11].location.y, Door[11].size.x, Door[11].size.y);
rect(Door[12].location.x, Door[12].location.y-10, Door[12].size.x, Door[12].size.y);
rect(keys.location.x, keys.location.y, keys.size.x, keys.size.y);

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

fill(0);
text(“6”, 300, 300);
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) {
rect(Door[14].location.x, Door[14].location.y, Door[14].size.x, Door[14].size.y);
rect(Door[13].location.x, Door[13].location.y, Door[13].size.x, Door[13].size.y);
rect(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””,100,100);
text (“Me?! A Narcisssist?!, can you believe it?!”,150,150);
text(“7”, 300, 300);
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) {
rect(Door[16].location.x-10, Door[16].location.y, Door[16].size.x, Door[16].size.y);
rect(keys.location.x, keys.location.y, keys.size.x, keys.size.y);

fill(200, 20, 20);
text(“This is weird. The keys are giving off a really creepy feeling.”,100,100);
text(“Is this a good idea? Maybe I should do as that voice said…”,150,150);
text(“8”, 300, 300);
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;
}
}
}
}

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