mirror of
https://github.com/wassname/phaser.git
synced 2026-06-29 16:30:29 +08:00
a
This commit is contained in:
+387
-521
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,45 @@
|
||||
<!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 });
|
||||
|
||||
function preload() {
|
||||
game.load.image('ship', 'assets/sprites/mana_card.png');
|
||||
}
|
||||
|
||||
var player;
|
||||
var aliens;
|
||||
|
||||
function create() {
|
||||
|
||||
player = game.add.sprite(400, 300, 'ship');
|
||||
player.anchor.setTo(0.5, 0.5);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
player.angle++;
|
||||
}
|
||||
|
||||
function render() {
|
||||
game.debug.renderSpriteCorners(player,true,true);
|
||||
game.debug.renderRectangle(player.body.bounds);
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -95,8 +95,8 @@ Phaser.Physics.Arcade.Body.prototype = {
|
||||
this.lastX = this.x;
|
||||
this.lastY = this.y;
|
||||
|
||||
this.x = this.sprite.x;
|
||||
this.y = this.sprite.y;
|
||||
this.x = this.sprite.x - this.offset.x + (this.sprite.anchor.x * this.width));
|
||||
this.y = this.sprite.y - this.offset.y + (this.sprite.anchor.y * this.height));
|
||||
this.rotation = this.sprite.angle;
|
||||
|
||||
if (this.moves)
|
||||
@@ -120,12 +120,14 @@ Phaser.Physics.Arcade.Body.prototype = {
|
||||
}
|
||||
|
||||
// Adjust the sprite based on all of the above, so the x/y coords will be correct going into the State update
|
||||
this.sprite.x = this.x - this.offset.x + (this.sprite.anchor.x * this.width);
|
||||
this.sprite.y = this.y - this.offset.y + (this.sprite.anchor.y * this.height);
|
||||
// this.sprite.x = this.x - this.offset.x + (this.sprite.anchor.x * this.width);
|
||||
// this.sprite.y = this.y - this.offset.y + (this.sprite.anchor.y * this.height);
|
||||
// this.sprite.x = this.x;
|
||||
// this.sprite.y = this.y;
|
||||
|
||||
if (this.allowRotation)
|
||||
{
|
||||
this.sprite.angle = this.rotation;
|
||||
// this.sprite.angle = this.rotation;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user