mirror of
https://github.com/wassname/phaser.git
synced 2026-08-17 11:23:42 +08:00
Started revamp of the Tilemap system. Also removed old 'Advanced Physics' and dropped in p2.js which is what I hope we'll eventually use.
This commit is contained in:
@@ -5,15 +5,14 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create });
|
||||
|
||||
var p;
|
||||
var p, tween, button, flag = false;
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('diamond', 'assets/sprites/diamond.png');
|
||||
game.load.spritesheet('button', 'assets/buttons/button_sprite_sheet.png', 193, 71);
|
||||
|
||||
}
|
||||
|
||||
@@ -23,13 +22,30 @@
|
||||
|
||||
p = game.add.sprite(100, 100, 'diamond');
|
||||
|
||||
game.add.tween(p).to({ x: 600 }, 2000, Phaser.Easing.Linear.None, true)
|
||||
tween = game.add.tween(p).to({ x: 600 }, 2000, Phaser.Easing.Linear.None)
|
||||
.to({ y: 300 }, 1000, Phaser.Easing.Linear.None)
|
||||
.to({ x: 100 }, 2000, Phaser.Easing.Linear.None)
|
||||
.to({ y: 100 }, 1000, Phaser.Easing.Linear.None)
|
||||
.loop();
|
||||
.loop()
|
||||
.start();
|
||||
|
||||
button = game.add.button(game.world.centerX, 400, 'button', actionOnClick, this, 2, 1, 0);
|
||||
}
|
||||
|
||||
function actionOnClick() {
|
||||
|
||||
if (flag) {
|
||||
console.log('started');
|
||||
tween.start();
|
||||
}
|
||||
else {
|
||||
console.log('stopped');
|
||||
tween.stop();
|
||||
}
|
||||
|
||||
flag = !flag;
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user