mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
47 lines
No EOL
752 B
PHP
47 lines
No EOL
752 B
PHP
<?php
|
|
$title = "Rotate point";
|
|
require('../head.php');
|
|
?>
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', {create: create,update:update,render:render});
|
|
|
|
var p1;
|
|
var p2;
|
|
var d=0;
|
|
|
|
function create() {
|
|
|
|
p1 = new Phaser.Point(200, 300);
|
|
p2 = new Phaser.Point(300, 300);
|
|
|
|
}
|
|
|
|
function update() {
|
|
|
|
p1.rotate(p2.x, p2.y, game.math.wrapAngle(d), true);
|
|
|
|
d++;
|
|
|
|
}
|
|
|
|
function render() {
|
|
|
|
game.context.fillStyle = 'rgb(255,255,0)';
|
|
game.context.fillRect(p1.x, p1.y, 4, 4);
|
|
|
|
game.context.fillStyle = 'rgb(255,0,0)';
|
|
game.context.fillRect(p2.x, p2.y, 4, 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<?php
|
|
require('../foot.php');
|
|
?>
|