mirror of
https://github.com/photonstorm/phaser
synced 2024-11-30 16:39:34 +00:00
22 lines
1.1 KiB
JavaScript
22 lines
1.1 KiB
JavaScript
/// <reference path="../../Phaser/Game.ts" />
|
|
/// <reference path="../../Phaser/gameobjects/ScrollZone.ts" />
|
|
(function () {
|
|
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
|
|
function init() {
|
|
myGame.loader.addImageFile('angelDawn', 'assets/pics/game14_angel_dawn.png');
|
|
myGame.loader.load();
|
|
}
|
|
var scroller;
|
|
function create() {
|
|
// This creates our ScrollZone centered in the middle of the stage.
|
|
scroller = myGame.createScrollZone('angelDawn', myGame.stage.centerX - 320, 100);
|
|
// By default we won't scroll the full image, but we will create 3 ScrollRegions within it:
|
|
// This creates a ScrollRegion which can be thought of as a rectangle within the ScrollZone that can be scrolled
|
|
// independantly - this one scrolls the image of the spacemans head
|
|
scroller.addRegion(32, 32, 352, 240, 0, 2);
|
|
// The head in the top right
|
|
scroller.addRegion(480, 30, 96, 96, 4, 0);
|
|
// The small piece of text
|
|
scroller.addRegion(466, 160, 122, 14, 0, -0.5);
|
|
}
|
|
})();
|