mirror of
https://github.com/wassname/phaser.git
synced 2026-08-12 12:20:38 +08:00
Fixed some errors in Rectangle and more Pixi hooks added, now creating the Stage properly and rendering sprites.
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
<script src="../src/core/StateManager.js"></script>
|
||||
<script src="../src/core/State.js"></script>
|
||||
<script src="../src/system/RequestAnimationFrame.js"></script>
|
||||
<script src="../src/system/Canvas.js"></script>
|
||||
<script src="../src/system/Device.js"></script>
|
||||
<script src="../src/core/SignalBinding.js"></script>
|
||||
<script src="../src/core/Signal.js"></script>
|
||||
@@ -54,6 +55,7 @@
|
||||
<script src="../src/math/Math.js"></script>
|
||||
<script src="../src/geom/Point.js"></script>
|
||||
<script src="../src/geom/Circle.js"></script>
|
||||
<script src="../src/geom/Rectangle.js"></script>
|
||||
<script src="../src/net/Net.js"></script>
|
||||
<script src="../src/tween/TweenManager.js"></script>
|
||||
<script src="../src/tween/Tween.js"></script>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>phaser.js - a new beginning</title>
|
||||
<?php
|
||||
require('js.php');
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var game = new Phaser.Game();
|
||||
|
||||
var r = new Phaser.Rectangle(0,0,100,100);
|
||||
|
||||
console.log(r);
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+32
-5
@@ -12,12 +12,14 @@
|
||||
|
||||
(function () {
|
||||
|
||||
// In this approach we're simply using functions in the current scope to do what we need
|
||||
var game = new Phaser.Game(800, 600, Phaser.RENDERER_AUTO, '', { preload: preload, create: create });
|
||||
// var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update });
|
||||
|
||||
var bunny;
|
||||
|
||||
function preload() {
|
||||
|
||||
console.log('*** preload called');
|
||||
console.log('***> preload called');
|
||||
game.load.image('cockpit', 'assets/pics/cockpit.png');
|
||||
game.load.image('overdose', 'assets/pics/lance-overdose-loader_eye.png');
|
||||
|
||||
@@ -25,8 +27,33 @@
|
||||
|
||||
function create() {
|
||||
|
||||
console.log('*** create called');
|
||||
document.body.appendChild(game.cache.getImage('cockpit'));
|
||||
console.log('***> create called');
|
||||
|
||||
// Create a basetexture
|
||||
var base = new PIXI.BaseTexture(game.cache.getImage('overdose'));
|
||||
var texture = new PIXI.Texture(base);
|
||||
bunny = new PIXI.Sprite(texture);
|
||||
|
||||
// center the sprites anchor point
|
||||
bunny.anchor.x = 0.5;
|
||||
bunny.anchor.y = 0.5;
|
||||
|
||||
// move the sprite t the center of the screen
|
||||
bunny.position.x = 200;
|
||||
bunny.position.y = 150;
|
||||
|
||||
game.stage._s.addChild(bunny);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
if (game.paused == false)
|
||||
{
|
||||
bunny.rotation += 0.1;
|
||||
bunny.scale.x += 0.01;
|
||||
bunny.scale.y += 0.01;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user