breakout/game.js
2023-05-25 01:46:08 +00:00

56 lines
1,004 B
JavaScript

Debug.draw_phys(true);
sim_start();
World.loadfile("lvl1.lvl");
var b = World.spawn(gameobjects['ball']);
b.collider.sensor = true;
b.draw_layer = 4;
var bb = World.spawn(gameobjects['ball']);
bb.pos = bb.pos.add([50,0]);
bb.draw_layer = 3;
//Sound.play("start.wav");
var camcontroller = {
input_a_down() {
cmd(99);
},
input_d_down() {
cmd(100);
},
input_q_down() {
cmd(98);
},
input_e_down() {
cmd(97);
},
input_w_down() { cmd(101); },
input_s_down() { cmd(102); },
};
var score = 0;
var highscore = 0;
var lives = 3;
function texttest() {
var xpos = 1000;
GUI.text("SCORE", [xpos,500],1,Color.red);
GUI.text(`${score}`, [xpos,480],1);
GUI.text("HIGH SCORE", [xpos,450],1, Color.red);
GUI.text(`${highscore}`, [xpos,430],1);
GUI.text(`LIVES: ${lives}`, [xpos, 400], 1, Color.white);
GUI.text("YARKANOID", [xpos,300], 1,[5,120,240]);
GUI.text("ODPLOT GAMES", [xpos,250],1);
GUI.text("[C] 2023", [xpos,230]);
}
register_gui(texttest);