Friday, November 27, 2020

Mosquito killer game

 Mosquito Killer Game



Codes:


var bg = createSprite(200,200);
bg.setAnimation("bg");

var racket = createSprite(200,200);
racket.setAnimation("racket");
racket.scale = 0.3;

var bee = createSprite(420,randomNumber(50,350))
bee.setAnimation("bee");
bee.scale = 0.5;
bee.velocityX = -3;

var score = 0;

function draw() {
  
  racket.x = World.mouseX;
  racket.y = World.mouseY;
  
  if(bee.x<0 || bee.y>400){
    
    bee.x = 420;
    bee.y = randomNumber(50,350);
    bee.velocityX = -3;
    bee.velocityY = 0;
    bee.setAnimation("bee");
  }
  
  if(mousePressedOver(bee)){
    
    bee.velocityX = 0;
    bee.velocityY = 8;
    bee.setAnimation("bee_dead");
    score = 1;
  }
  
  drawSprites();
  
  textSize(20);
  fill("white");
  text("Score: "+score,300,25);
  
}

Download Sprites Here


Video:




Previous Post
Next Post

post written by:

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete