2013-09-01 02:15:27 +00:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>phaser.js - a new beginning</title>
|
|
|
|
<?php
|
|
|
|
require('js.php');
|
|
|
|
?>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
|
|
|
|
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render });
|
|
|
|
|
2013-09-01 02:57:24 +00:00
|
|
|
var s;
|
|
|
|
var s2;
|
|
|
|
|
2013-09-01 02:15:27 +00:00
|
|
|
function preload() {
|
2013-09-01 02:57:24 +00:00
|
|
|
game.load.image('card', 'assets/sprites/mana_card.png');
|
|
|
|
game.load.image('mushroom', 'assets/sprites/mushroom2.png');
|
2013-09-01 02:15:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function create() {
|
|
|
|
|
2013-09-01 02:57:24 +00:00
|
|
|
s = game.add.sprite(game.world.centerX, game.world.centerY, 'card');
|
|
|
|
s2 = game.add.sprite(100, 100, 'mushroom');
|
|
|
|
|
|
|
|
s.addChild(s2);
|
2013-09-01 02:15:27 +00:00
|
|
|
|
2013-09-01 04:29:53 +00:00
|
|
|
s.scale.x = 2;
|
|
|
|
s.scale.y = 2;
|
|
|
|
s2.scale.x = 0.5;
|
|
|
|
s2.scale.y = 0.5;
|
2013-09-01 04:22:08 +00:00
|
|
|
|
2013-09-01 02:15:27 +00:00
|
|
|
s.anchor.setTo(0.5, 0.5);
|
2013-09-01 04:29:53 +00:00
|
|
|
s2.anchor.setTo(0, 0);
|
2013-09-01 02:15:27 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function update() {
|
|
|
|
|
|
|
|
s.angle += 0.5;
|
2013-09-01 04:29:53 +00:00
|
|
|
s2.angle += 1;
|
2013-09-01 02:15:27 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function render() {
|
|
|
|
|
2013-09-01 04:22:08 +00:00
|
|
|
game.debug.renderWorldTransformInfo(s, 32, 32);
|
|
|
|
game.debug.renderLocalTransformInfo(s, 300, 32);
|
|
|
|
|
|
|
|
game.debug.renderWorldTransformInfo(s2, 32, 450);
|
|
|
|
game.debug.renderLocalTransformInfo(s2, 300, 450);
|
2013-09-01 02:57:24 +00:00
|
|
|
|
2013-09-01 02:15:27 +00:00
|
|
|
game.debug.renderPoint(s.topLeft, 'rgb(255,0,0)');
|
|
|
|
game.debug.renderPoint(s.topRight, 'rgb(0,255,0)');
|
|
|
|
game.debug.renderPoint(s.bottomLeft, 'rgb(0,0,255)');
|
|
|
|
game.debug.renderPoint(s.bottomRight, 'rgb(255,0,255)');
|
|
|
|
|
2013-09-01 02:57:24 +00:00
|
|
|
game.debug.renderPoint(s2.topLeft, 'rgb(255,0,0)');
|
|
|
|
game.debug.renderPoint(s2.topRight, 'rgb(0,255,0)');
|
|
|
|
game.debug.renderPoint(s2.bottomLeft, 'rgb(0,0,255)');
|
|
|
|
game.debug.renderPoint(s2.bottomRight, 'rgb(255,0,255)');
|
|
|
|
|
2013-09-01 02:15:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|