i am trying to move the background when pressing the left button, i am using phaser and here is the code:
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>hello phaser!</title>
<script src="phaser.min.js"></script>
</head>
<body>
<script type="text/javascript">
window.onload = function() {
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', {
preload : preload,
create : create,
update : update
});
var score = 0;
var scoreText;
function preload() {
game.load.image('sky', 'sky.png');
}
function create() {
game.physics.startSystem(Phaser.Physics.ARCADE);
game.add.sprite(0, 0, 'sky');
}
function update() {
cursors = game.input.keyboard.createCursorKeys();
if (cursors.left.isDown) {
sky.body.velocity.x = -150;
}
}
};
</script>
</body>
</html>
when i run it nothing happen to the background and i do not know where is the problem
Aucun commentaire:
Enregistrer un commentaire