xxxxxxxxxx
126
let roboto;
let radius;
let character;
let robin, starfire, raven, cyborg, beastBoy;
let gameState = 'home';
function preload(){
roboto = loadFont('assets/Roboto-BlackItalic.ttf');
robin = loadImage('assets/robin.png');
starfire = loadImage('assets/starfire.png');
cyborg = loadImage('assets/cyborg.png');
raven = loadImage('assets/raven.png');
beastBoy = loadImage('assets/beast boy.png');
}
function setup() {
createCanvas(400, 400);
}
function draw() {
background(0,255,255);
if(gameState == 'home'){
home();
}
else if(gameState == 'chars'){
chars();
}
else if(gameState == 'flap'){
}
}
function home() {
rectMode(CENTER);
fill(255,175,135);
stroke(255,175,135);
strokeWeight(100);
strokeJoin(ROUND);
triangle(250,250,190,275,310,275);
noStroke();
fill(0,100,255);
rect(200,325,400,150);
fill(255,255,0);
rect(350,50,50,50,20);
fill(0,200,255);
rect(250,170,40,125);
rect(250,110,120,40);
noFill();
stroke(255);
strokeWeight(10);
line(230,135,230,230);
line(270,135,270,230);
line(230,230,270,230);
line(190,135,230,135);
line(270,135,310,135);
line(190,95,190,135);
line(310,95,310,135);
line(190,95,310,95);
stroke(0,255,255,100);
strokeWeight(5+radius);
textSize(56+radius/2);
textFont(roboto);
fill(0,255,255);
text('Flappy Titans', 35,342)
stroke(0,120,255,100);
fill(0,120,255);
radius = sin(frameCount/10);
circle(90,155,radius+100);
fill(0,255,210);
stroke(0,255,210,100);
strokeWeight(3);
triangle(75-radius, 132-radius, 75-radius, 178+radius, 115+radius, 155);
if(dist(mouseX,mouseY,90,155) < radius+50 && mouseIsPressed){
gameState = 'chars';
}
}
function chars(){
radius = sin(frameCount/10);
textSize(50+radius);
textFont(roboto);
stroke(255,255,255,200);
strokeWeight(5+radius);
fill(0,180,255);
textAlign(CENTER);
text('Choose Your Character',200,125,375,200);
imageMode(CENTER);
image(robin,200,210,60,72);
image(starfire,80,215,60,72);
image(raven,320,210,70,67);
image(cyborg,120,330,63,67);
image(beastBoy,280,330,83,60);
textSize(30+radius);
fill(255,50,255);
text('Starfire',80,275);
fill(255,50,50);
text('Robin',200,275);
fill(110,100,210);
text('Raven',320,275);
fill(0,180,255);
text('Cyborg',120,390);
fill(50,255,50);
text('Beast Boy',280,390);
if(mouseIsPressed){
if(dist(mouseX,mouseY,200,210) < 30){
character = 'robin';
gameState = 'flap';
}
if(dist(mouseX,mouseY,80,215) < 30){
character = 'starfire';
gameState = 'flap';
}
if(dist(mouseX,mouseY,320,210) < 30){
character = 'raven';
gameState = 'flap';
}
if(dist(mouseX,mouseY,120,330) < 30){
character = 'cyborg';
gameState = 'flap';
}
if(dist(mouseX,mouseY,280,330) < 40){
character = 'beast boy';
gameState = 'flap';
}
}
}