This commit is contained in:
John Alanbrook 2023-05-30 12:30:38 +00:00
parent a2ef1481b3
commit 573f2a3639

View file

@ -7,6 +7,7 @@ var lvlwidth = 450;
var lvlheight = 600;
let bricks = 0;
let allbricks = [];
//var frameworld = World
@ -29,13 +30,14 @@ brick.kill();
var fitbricks = Math.floor(lvlwidth/bwidth);
let towin = function()
{
}
let wingame = function() {
towin();
allballs.forEach(x=>x.kill());
Log.warn("WINNER");
Player.players[0].uncontrol(paddle);
register_gui(function() {
GUI.text("WINNER", Window.dimensions.scale(0.5));
});
}
let killbrick = function() {
@ -49,6 +51,7 @@ var rowbricks = 8;
for (var row = 0; row < rowbricks; row++) {
for (var col = 0; col < 6; col++) {
var brick = World.spawn(gameobjects['brick']);
allbricks.push(brick);
brick.stop = function() { killbrick(); };
bricks++;
@ -99,6 +102,8 @@ paddle.extents = lvlwidth/2 - f.edge2d.thickness;
paddle.pos = [0,-lvlheight/2+paddle.height*4];
paddle.setgrow(1);
let allballs = [];
Gamestate.spawnball = function() {
var bb = World.spawn(gameobjects['ball']);
bb.pos = bb.pos.add([0,-200]);
@ -106,6 +111,7 @@ Gamestate.spawnball = function() {
bb.draw_layer = 3;
bb.tag = 'ball';
balls++;
allballs.push(bb);
}
function spawn_powerup(pos, fn) {
@ -118,7 +124,7 @@ function spawn_powerup(pos, fn) {
function multiball(n) {
for (var i = 0; i < n; i++)
Gamestate.spawnball();
};
}
function lostball()
{
@ -166,7 +172,7 @@ let gamepawn =
input_o_pressed() {
/* Get all bricks and kill */
allbricks.forEach(x => x.kill());
},
}