xxxxxxxxxx
81
var tela = 1;
var img;
var contGeral = 0;
var segundos = 0;
function preload() {
img = loadImage('mesa.jpeg');
}
function setup() {
createCanvas(400, 400);
}
function draw() {
// Tela incial
if (tela == 1) {
//image(img,-240,-120);
background(0);
fill(240);
textSize(32);
text("Jogo X ", 130, 100);
textSize(26);
text("c - Créditos", 100, 200);
text("j - Jogar", 100, 260);
text("m - Manual", 100, 320);
noFill();
stroke(200,255,200);
strokeWeight(4);
rect(50,50,300,80,10);
strokeWeight(1);
stroke(30);
// Contruir o menu
// Créditos
if (key == 'c') {
tela = 2;
}
// Jogar
if (key == 'j') {
tela = 3;
}
// Manual
if (key == 'm') {
tela = 4;
}
}
// Tela de Créditos
if (tela == 2) {
background(10, 200, 200);
fill(250);
textSize(32);
text("Créditos ", 130, 100);
}
// Tela do jogo em ação
if (tela == 3 ){
background(200, 20, 200);
fill(250);
textSize(32);
text("Jogo em ação ", 80, 100);
contGeral++;
if (contGeral%30 == 0) {
segundos++;
}
text(segundos,100,200);
if ( keyCode == ENTER) {
tela = 1;
}
}
if (tela == 4) {
image(img,-240,-120);
}
}