Fixing collision issues

This commit is contained in:
Richard Davey
2013-09-23 01:06:09 +01:00
parent b69b3db486
commit bc02a1a05e
10 changed files with 118 additions and 80 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

+8 -1
View File
@@ -7,7 +7,7 @@
(function () {
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render });
function preload() {
@@ -88,6 +88,13 @@
}
function render () {
game.debug.renderQuadTree(game.physics.quadTree);
}
})();
</script>
+8 -14
View File
@@ -23,8 +23,6 @@
var bullets;
var bulletTime = 0;
var pickle;
function create() {
player = game.add.sprite(400, 500, 'ship');
@@ -36,13 +34,12 @@
{
for (var x = 0; x < 10; x++)
{
aliens.create(170 + x * 48, 100 + y * 50, 'alien');
aliens.create(x * 48, y * 50, 'alien');
}
}
// Shows off a known bug:
// aliens.x = 100;
// aliens.y = 50;
aliens.x = 100;
aliens.y = 50;
bullets = game.add.group(null, 'bullets');
@@ -52,18 +49,15 @@
b.name = 'bullet' + i;
b.exists = false;
b.visible = false;
b.anchor.setTo(0.5, 1);
b.events.onOutOfBounds.add(resetBullet, this);
}
// Shows off a known bug:
// var tween = game.add.tween(aliens).to({x: 200}, 3000, Phaser.Easing.Linear.None, true, 0, 1000, true);
// tween.onComplete.add(descend, this);
var tween = game.add.tween(aliens).to({x: 200}, 3000, Phaser.Easing.Linear.None, true, 0, 1000, true);
tween.onComplete.add(descend, this);
}
function overAlien () {
console.log('over pickle');
}
function descend() {
aliens.y += 10;
@@ -100,7 +94,7 @@
if (bullet)
{
bullet.reset(player.x + 6, player.y - 8);
bullet.reset(player.x, player.y - 8);
bullet.velocity.y = -300;
bulletTime = game.time.now + 250;
}
@@ -122,7 +116,7 @@
function render () {
aliens.forEach(renderBounds, this);
// aliens.forEach(renderBounds, this);
game.debug.renderQuadTree(game.physics.quadTree);
+6 -3
View File
@@ -9,9 +9,12 @@
if (isset($mobile))
{
?>
<meta name="viewport" content="initial-scale=1 maximum-scale=1 user-scalable=0" />
<?php
echo ' <meta name="viewport" content="initial-scale=1 maximum-scale=1 user-scalable=0" />';
}
if (isset($css))
{
echo " <style>$css</style>";
}
?>
</head>