xxxxxxxxxx
var chat;
var img;
var a=1;
var sprite1;
var sprite2;
var sprite3;
var sprite4;
var sprite5;
var img2;
var smIMG2;
var sprite3;
var gameover;
var arbre;
var arbre2;
var buisson;
var oi;
var zo;
var zo2;
var zo3;
var zo4;
var zo5;
var score = 0;
var wallTop, wallBottom, wallLeft, wallRight;
var WALL_THICKNESS = 30;
var score = 0;
function preload() {
img = loadImage("new-super-mario-bros-4e264ddcc5e91.png")
smImg2 = loadImage('chat.png');
buisson = loadImage('buisson.png')
arbre = loadImage('arbre1.png')
arbre2 = loadImage('arbre2.png')
oi = loadImage('oiseau.png')
}
function setup() {
createCanvas(1100, 500);
wallTop = createSprite(width/2, -WALL_THICKNESS/2, width+WALL_THICKNESS*2, WALL_THICKNESS);
wallTop.immovable = true;
wallBottom = createSprite(width/2, height+WALL_THICKNESS/2, width+WALL_THICKNESS*2, WALL_THICKNESS);
wallBottom.immovable = true;
wallLeft = createSprite(-WALL_THICKNESS/2, height/2, WALL_THICKNESS, height);
wallLeft.immovable = true;
wallRight = createSprite(width+WALL_THICKNESS/2, height/2, WALL_THICKNESS, height);
wallRight.immovable = true;
chat = createSprite(width/2, height/2);
chat.addImage(smImg2);
chat.velocity.y = 0;
chat.setCollider("circle", 0,0,20);
sprite1 = createSprite(width/1.5, height/1.02, 200, 100);
sprite1.addImage(buisson);
sprite2 = createSprite(width/1.1, height/1.15, 50, 100);
sprite2.addImage(arbre)
sprite3 = createSprite(width/2.45, height/1.02, 60, 80);
sprite3.addImage(buisson)
sprite4 = createSprite(width/3.1, height/1.15, 60, 190);
sprite4.addImage(arbre2)
sprite5 = createSprite(width/7, height/1.15, 60, 80);
sprite5.addImage(arbre)
zo1 = createSprite();
zo1.addImage(oi);
zo2 = createSprite();
zo2.addImage(oi)
zo3 = createSprite();
zo3.addImage(oi)
zo4 = createSprite();
zo4.addImage(oi)
zo5 = createSprite();
zo5.addImage(oi)
zo = createSprite()
zo.addImage(oi)
}
function draw()
{
background(200);
if(chat.position.y >= height) {
chat.velocity.y *= -1.05;
chat.position.y = height;
}
chat.addSpeed(0.25, 90);
{
image(img, 0, 0);
}
chat.bounce(wallTop);
chat.bounce(wallBottom);
chat.bounce(wallLeft);
chat.bounce(wallRight);
zo.position.x = (100,300);
zo.position.y =(100,300);
zo1.position.x = (200,500);
zo1.position.y =(150,110);
zo2.position.x = (125,750);
zo2.position.y =(50,175);
zo3.position.x = (200,1000);
zo3.position.y =(150,280);
zo4.position.x = (200,615);
zo4.position.y =(150,380);
zo5.position.x = (200,150);
zo5.position.y =(150,110);
if(chat.bounce(sprite1) || chat.bounce(sprite2) || chat.bounce(sprite3) || chat.bounce(sprite4) || chat.bounce(sprite5)){
chat.remove();
sprite1.remove();
sprite2.remove();
sprite3.remove();
sprite4.remove();
sprite5.remove();
chat = createSprite(width/2, height/2,0,0);
chat.addImage(smImg2);
sprite1 = createSprite(width/1.5, height/1.02, 200, 100);
sprite1.addImage(buisson);
sprite2 = createSprite(width/1.1, height/1.15, 50, 100);
sprite2.addImage(arbre)
sprite3 = createSprite(width/2.45, height/1.02, 60, 80);
sprite3.addImage(buisson)
sprite4 = createSprite(width/3.1, height/1.15, 60, 190);
sprite4.addImage(arbre2)
sprite5 = createSprite(width/7, height/1.15, 60, 80);
sprite5.addImage(arbre)
}
if(chat.bounce(zo1) || chat.bounce(zo) || chat.bounce(zo1) || chat.bounce(zo2) || chat.bounce(zo3) || chat.bounce(zo4) || chat.bounce(zo5)){
chat.remove();
zo.remove();
zo1.remove();
zo2.remove();
zo3.remove();
zo4.remove();
zo5.remove();
chat = createSprite(width/2, height/2,0,0);
chat.addImage(smImg2);
zo = createSprite();
zo.addImage(oi)
zo1 = createSprite();
zo1.addImage(oi);
zo2 = createSprite();
zo2.addImage(oi)
zo3 = createSprite();
zo3.addImage(oi)
zo4 = createSprite();
zo4.addImage(oi)
zo5 = createSprite();
zo5.addImage(oi)
}
drawSprites();
}
function keyPressed() {
if (keyCode == RIGHT_ARROW || chat.position.y >= height) {
chat.velocity.y *= -1;
chat.addSpeed(1.5, 0);
}
else if (keyCode == LEFT_ARROW || chat.position.y >= height) {
chat.velocity.y *= -1;
chat.addSpeed(1.5, 180);
}
return false;
}
> p5.js says: It looks like there was a problem loading your image. Try checking if the file path [https://deckard.openprocessing.org/user107566/visual474923/h5b2c51d2c15120402479412f40b892b3/new-super-mario-bros-4e264ddcc5e91.png] is correct, hosting the image online, or running a local server.[https://github.com/processing/p5.js/wiki/Local-server]
> p5.js says: It looks like there was a problem loading your image. Try checking if the file path [https://deckard.openprocessing.org/user107566/visual474923/h5b2c51d2c15120402479412f40b892b3/chat.png] is correct, hosting the image online, or running a local server.[https://github.com/processing/p5.js/wiki/Local-server]
> p5.js says: It looks like there was a problem loading your image. Try checking if the file path [https://deckard.openprocessing.org/user107566/visual474923/h5b2c51d2c15120402479412f40b892b3/buisson.png] is correct, hosting the image online, or running a local server.[https://github.com/processing/p5.js/wiki/Local-server]
> p5.js says: It looks like there was a problem loading your image. Try checking if the file path [https://deckard.openprocessing.org/user107566/visual474923/h5b2c51d2c15120402479412f40b892b3/arbre1.png] is correct, hosting the image online, or running a local server.[https://github.com/processing/p5.js/wiki/Local-server]
> p5.js says: It looks like there was a problem loading your image. Try checking if the file path [https://deckard.openprocessing.org/user107566/visual474923/h5b2c51d2c15120402479412f40b892b3/arbre2.png] is correct, hosting the image online, or running a local server.[https://github.com/processing/p5.js/wiki/Local-server]