示例#1
0
 public void Update(float dt, SnailAssalt game) {
   super.Update(dt, game);
   if (Math.random() > 0.95) {
     game.addSlime(new Droppings(this.bound.x, this.bound.y));
   }
   seconds = Math.max(seconds - dt, 0);
   flash = seconds > 0;
   this.bound.x = this.bound.x + this.speed.x;
   this.bound.y = this.bound.y + this.speed.y;
   if (this.bound.overlaps(House.Housebounds)) {
     this.bound.setX(House.Housebounds.x - (this.bound.getWidth()));
     House.hp -= this.Attack * dt;
     this.speed.y = 0;
   }
   if (this.bound.y >= height) {
     this.speed.y = this.speed.y * -1;
   }
   if (this.bound.y <= 0) {
     this.speed.y = this.speed.y * -1;
   }
 }
 public boolean isPressed() {
   return (Gdx.input.justTouched()
       && this.bound.contains(SnailAssalt.getTapPosition().x, SnailAssalt.getTapPosition().y));
 }