mirror of
https://github.com/wassname/phaser.git
synced 2026-08-03 13:10:25 +08:00
46 tests with assets and javascript code.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
(function () {
|
||||
var game = new Phaser.Game(this, 'game', 800, 600, init, create, null, render);
|
||||
|
||||
// Left and right group.
|
||||
var left, right;
|
||||
// The first selected item.
|
||||
var selected = null;
|
||||
|
||||
function init() {
|
||||
game.load.spritesheet('item', 'assets/buttons/number-buttons-90x90.png', 90, 90);
|
||||
game.load.start();
|
||||
}
|
||||
function create() {
|
||||
left = game.add.group();
|
||||
right = new Phaser.Group(game);
|
||||
// Add some items to left side, and set a onDragStop listener
|
||||
// to limit its location when dropped.
|
||||
var item;
|
||||
for (var i = 0; i < 3; i++) {
|
||||
// Directly create sprites from the left group.
|
||||
item = left.addNewSprite(250, 98 * (i + 1), 'item', i, Phaser.Types.BODY_DISABLED);
|
||||
// Add another to the right group.
|
||||
item = right.addNewSprite(348, 98 * (i + 1), 'item', i + 3, Phaser.Types.BODY_DISABLED);
|
||||
}
|
||||
|
||||
exCamera = game.add.camera(0, 0, 800, 600);
|
||||
exCamera.setPosition(120, 0);
|
||||
}
|
||||
function render() {
|
||||
right.directRender(exCamera);
|
||||
|
||||
Phaser.DebugUtils.context.fillStyle = '#fff';
|
||||
Phaser.DebugUtils.context.fillText('Left Group', 300, 80);
|
||||
Phaser.DebugUtils.context.fillText('Right Group', 400, 80);
|
||||
Phaser.DebugUtils.context.fillText('Left group is normally rendered, while the right one is ONLY rendered directly to another camera.', 120, 480);
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user