mirror of
https://github.com/wassname/phaser.git
synced 2026-08-15 12:45:11 +08:00
yuidoc scripts added. Tidied up the Docs folder. Added back in the Emitter and fixed the Tests that weren't compiling.
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
(function () {
|
||||
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, update, render);
|
||||
|
||||
function preload() {
|
||||
game.load.image('backdrop', 'assets/pics/remember-me.jpg');
|
||||
game.load.image('melon', 'assets/sprites/melon.png');
|
||||
}
|
||||
|
||||
function create() {
|
||||
game.world.setSize(1920, 1200, true);
|
||||
|
||||
game.add.sprite(0, 0, 'backdrop');
|
||||
for(var i = 0; i < 100; i++) {
|
||||
|
||||
for (var i = 0; i < 100; i++) {
|
||||
game.add.sprite(game.world.randomX, game.world.randomY, 'melon');
|
||||
}
|
||||
|
||||
//game.camera.texture.alpha = 0.5;
|
||||
//game.camera.width = 400;
|
||||
game.camera.texture.opaque = true;
|
||||
@@ -19,24 +24,28 @@
|
||||
game.camera.setPosition(game.stage.centerX, game.stage.centerY);
|
||||
//game.camera.setPosition(0, 0);
|
||||
//console.log('cam', game.camera.width, game.camera.height);
|
||||
}
|
||||
}
|
||||
|
||||
function update() {
|
||||
game.camera.rotation++;
|
||||
if(game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
|
||||
game.camera.rotation--;
|
||||
|
||||
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
|
||||
//game.camera.x -= 4;
|
||||
game.camera.transform.scale.x -= 0.1;
|
||||
game.camera.transform.scale.y -= 0.1;
|
||||
} else if(game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
|
||||
} else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
|
||||
//game.camera.x += 4;
|
||||
game.camera.transform.scale.x += 0.1;
|
||||
game.camera.transform.scale.y += 0.1;
|
||||
}
|
||||
if(game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
|
||||
|
||||
if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
|
||||
game.camera.y -= 4;
|
||||
} else if(game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
|
||||
} else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
|
||||
game.camera.y += 4;
|
||||
}
|
||||
}
|
||||
|
||||
function render() {
|
||||
Phaser.DebugUtils.renderCameraInfo(game.camera, 32, 32);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user