gui
This commit is contained in:
parent
573f2a3639
commit
c165e2e1f1
|
@ -155,11 +155,11 @@ killbox.polygon2d.points = Geometry.box(lvlwidth,30);
|
||||||
killbox.pos = [0,-lvlheight/2];
|
killbox.pos = [0,-lvlheight/2];
|
||||||
killbox.polygon2d.sensor = true;
|
killbox.polygon2d.sensor = true;
|
||||||
killbox.register_hit(hit => {
|
killbox.register_hit(hit => {
|
||||||
if (hit.obj.tag !== 'ball')
|
if (hit.obj.tag === 'ball') {
|
||||||
return;
|
|
||||||
|
|
||||||
hit.obj.kill();
|
hit.obj.kill();
|
||||||
lostball();
|
lostball();
|
||||||
|
}
|
||||||
|
|
||||||
}, killbox);
|
}, killbox);
|
||||||
|
|
||||||
//Sound.play("start.wav");
|
//Sound.play("start.wav");
|
||||||
|
|
|
@ -150,10 +150,10 @@ var paddle = gameobject.clone("paddle", {
|
||||||
collide(hit) {
|
collide(hit) {
|
||||||
if (!(hit.obj.from === 'ball')) return;
|
if (!(hit.obj.from === 'ball')) return;
|
||||||
var xdiff = hit.pos.x - this.pos.x;
|
var xdiff = hit.pos.x - this.pos.x;
|
||||||
if (Math.sign(xdiff) === Math.sign(hit.obj.velocity)) return;
|
// if (Math.sign(xdiff) === Math.sign(hit.obj.velocity)) return;
|
||||||
var oldvel = hit.obj.velocity;
|
var oldvel = hit.obj.velocity;
|
||||||
var scaler = Math.max(Math.abs(xdiff)/30, 1);
|
var scaler = Math.max(Math.abs(xdiff)/30, 1);
|
||||||
hit.obj.velocity = hit.obj.velocity.mult([-1,1]).scale(scaler);
|
hit.obj.velocity = hit.obj.velocity.scale(scaler);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
function startmenu() {
|
function startmenu() {
|
||||||
|
|
||||||
GUI.text("Press ENTER to start", Window.dimensions.scale(0.5));
|
GUI.text("Press ENTER to start", Window.dimensions.scale(0.5));
|
||||||
GUI.text("Press ESCAPE to exit", Window.dimensions.scale(0.5).add([0,-100]));
|
GUI.text("Press ESCAPE to exit", Window.dimensions.scale(0.5).add([0,-100]));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue