mirror of
https://github.com/wassname/phaser.git
synced 2026-07-12 00:50:45 +08:00
Much more stable collision, just need to refactor the Tilemap handling - see if I can optimise it a bit too.
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
$title = "Camera Cull";
|
||||
require('../head.php');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
game.load.image('disk', 'assets/sprites/ra_dont_crack_under_pressure.png');
|
||||
}
|
||||
|
||||
var s;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#182d3b';
|
||||
|
||||
s = game.add.sprite(game.world.centerX, game.world.centerY, 'disk');
|
||||
s.anchor.setTo(0.5, 0.5);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
s.rotation += 0.01;
|
||||
|
||||
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT))
|
||||
{
|
||||
s.x -= 4;
|
||||
}
|
||||
else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
|
||||
{
|
||||
s.x += 4;
|
||||
}
|
||||
|
||||
if (game.input.keyboard.isDown(Phaser.Keyboard.UP))
|
||||
{
|
||||
s.y -= 4;
|
||||
}
|
||||
else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN))
|
||||
{
|
||||
s.y += 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderSpriteCorners(s, true, true);
|
||||
game.debug.renderSpriteInfo(s, 20, 32);
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require('../foot.php');
|
||||
?>
|
||||
Reference in New Issue
Block a user