04.05.2024
проект
перестрелка самолётов

Вы летели в обычном самолёте. Но вдруг на вас напал вражеский самолёт. И вы должны подбить вражеский самолёт. (у самолёта 100 жизней, у вас урон от попаданий 5)

Сборки проекта

Версия "проект перестрелка самолётов" находится на проверке у модератора
Комментарии (3)
let game = new Game() let stage = new Stage() let xS = 0 let yS = 0 let player = new Sprite() player.addCostume('самолёт игрока.png') player.size = 70 player.y = 600 playerspeed = 10 b = new Sprite() b.addCostume('bullets.png') b.size = 5 b.hidden = true bspeed = 7 canFire1 = true function drawhp(context){ context.font = "30px Marker" context.fillStyle = "red" context.fillText('vrag hp' + vraghp, 50,50) } stage.forever(function(){ if (game.keyPressed('e') && canFire1){ canFire1 = false setTimeout(function(){ canFire1 = true },2000) bc = b.createClone() bc.x = player.x bc.y = player.y bc.size = 50 bc.hidden = false bc.forever(function(){ bc.move(15) if(vrag.touchSprite(bc)){ vraghp -= 1 bc.delete() } if(vraghp<1)vrag.delete() if (bc.y<0) bc.delete() }) } }) let musicPlay = false function gameCucle(){ player.x += xS xS *= 0.97 if (game.keyPressed("d")){ xS += 1 } if (game.keyPressed("a")){ xS -= 1 } if(player.x<0) player.x=0 if(player.x>stage.width) player.x=stage.width if(vrag.x<0 ) vragspeed = 10 if(vrag.x>stage.width ) vragspeed = -10 if(game.keyPressed('f')){ musicPlay = !musicPlay } if(vraghp<5) vrag.switchCostume(1) if(vraghp<1) { vrag.switchCostume(2) game.stop() } if(musicPlay == true) { player.playSound(0) } vrag.x += vragspeed } player.addSound('music.mp3') stage.forever(gameCucle) let vrag = new Sprite() vrag.addCostume('самолёт врага.png') vrag.addCostume('фаза2.png') vrag.addCostume('взрыв.png') vrag.size = 70 vrag.y = 70 vragspeed = 10 vraghp = 15 stage.addBackground('https://gagaru.club/uploads/posts/2023-05/1685453533_gagaru-club-p-oblaka-vid-sverkhu-1.jpg') stage.pen(drawhp) game.run()