mirror of
https://github.com/wassname/phaser.git
synced 2026-07-19 11:26:26 +08:00
Preparing new tests
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
(function () {
|
||||
// Here we create a quite tiny game (320x240 in size)
|
||||
var myGame = new Phaser.Game(this, 'game', 320, 240, init, create, update, render);
|
||||
function init() {
|
||||
// This sets a limit on the up-scale
|
||||
myGame.stage.scale.maxWidth = 640;
|
||||
myGame.stage.scale.maxHeight = 480;
|
||||
// Then we tell Phaser that we want it to scale up to whatever the browser can handle, but to do it proportionally
|
||||
myGame.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;
|
||||
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
|
||||
myGame.loader.load();
|
||||
}
|
||||
function create() {
|
||||
myGame.world.setSize(2000, 2000);
|
||||
for(var i = 0; i < 1000; i++) {
|
||||
myGame.add.sprite(myGame.world.randomX, myGame.world.randomY, 'melon');
|
||||
}
|
||||
}
|
||||
function update() {
|
||||
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
|
||||
myGame.camera.scroll.x -= 4;
|
||||
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
|
||||
myGame.camera.scroll.x += 4;
|
||||
}
|
||||
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
|
||||
myGame.camera.scroll.y -= 4;
|
||||
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
|
||||
myGame.camera.scroll.y += 4;
|
||||
}
|
||||
}
|
||||
function render() {
|
||||
myGame.input.renderDebugInfo(16, 16);
|
||||
}
|
||||
})();
|
||||
@@ -1,62 +0,0 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
|
||||
(function () {
|
||||
|
||||
// Here we create a quite tiny game (320x240 in size)
|
||||
var myGame = new Phaser.Game(this, 'game', 320, 240, init, create, update, render);
|
||||
|
||||
function init() {
|
||||
|
||||
// This sets a limit on the up-scale
|
||||
myGame.stage.scale.maxWidth = 640;
|
||||
myGame.stage.scale.maxHeight = 480;
|
||||
|
||||
// Then we tell Phaser that we want it to scale up to whatever the browser can handle, but to do it proportionally
|
||||
myGame.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;
|
||||
|
||||
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
|
||||
|
||||
myGame.loader.load();
|
||||
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
myGame.world.setSize(2000, 2000);
|
||||
|
||||
for (var i = 0; i < 1000; i++)
|
||||
{
|
||||
myGame.add.sprite(myGame.world.randomX, myGame.world.randomY, 'melon');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
|
||||
{
|
||||
myGame.camera.scroll.x -= 4;
|
||||
}
|
||||
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
|
||||
{
|
||||
myGame.camera.scroll.x += 4;
|
||||
}
|
||||
|
||||
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
|
||||
{
|
||||
myGame.camera.scroll.y -= 4;
|
||||
}
|
||||
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
|
||||
{
|
||||
myGame.camera.scroll.y += 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
myGame.input.renderDebugInfo(16, 16);
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -1,23 +0,0 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
(function () {
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
|
||||
function init() {
|
||||
myGame.loader.addImageFile('dragonsun', 'assets/pics/cougar_dragonsun.png');
|
||||
myGame.loader.load();
|
||||
}
|
||||
function create() {
|
||||
console.log('dragons 8');
|
||||
myGame.input.onDown.add(test1, this);
|
||||
}
|
||||
function test1() {
|
||||
console.log('down');
|
||||
}
|
||||
function update() {
|
||||
}
|
||||
function render() {
|
||||
myGame.input.pointer1.renderDebug();
|
||||
myGame.input.pointer2.renderDebug();
|
||||
myGame.input.pointer3.renderDebug();
|
||||
myGame.input.pointer4.renderDebug();
|
||||
}
|
||||
})();
|
||||
@@ -1,40 +0,0 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
|
||||
(function () {
|
||||
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
|
||||
|
||||
function init() {
|
||||
|
||||
myGame.loader.addImageFile('dragonsun', 'assets/pics/cougar_dragonsun.png');
|
||||
|
||||
myGame.loader.load();
|
||||
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
console.log('dragons 8');
|
||||
|
||||
myGame.input.onDown.add(test1, this);
|
||||
|
||||
}
|
||||
|
||||
function test1() {
|
||||
console.log('down');
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
myGame.input.pointer1.renderDebug();
|
||||
myGame.input.pointer2.renderDebug();
|
||||
myGame.input.pointer3.renderDebug();
|
||||
myGame.input.pointer4.renderDebug();
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -1,39 +0,0 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
(function () {
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
|
||||
function init() {
|
||||
myGame.loader.addImageFile('ball0', 'assets/sprites/yellow_ball.png');
|
||||
myGame.loader.addImageFile('ball1', 'assets/sprites/aqua_ball.png');
|
||||
myGame.loader.addImageFile('ball2', 'assets/sprites/blue_ball.png');
|
||||
myGame.loader.addImageFile('ball3', 'assets/sprites/green_ball.png');
|
||||
myGame.loader.addImageFile('ball4', 'assets/sprites/red_ball.png');
|
||||
myGame.loader.addImageFile('ball5', 'assets/sprites/purple_ball.png');
|
||||
myGame.loader.load();
|
||||
}
|
||||
var balls;
|
||||
function create() {
|
||||
balls = myGame.add.group();
|
||||
myGame.input.onTap.add(tapped, this);
|
||||
}
|
||||
function tapped(pointer, doubleTap) {
|
||||
if(balls.countDead() > 0) {
|
||||
var tempBall = balls.getFirstDead();
|
||||
tempBall.revive();
|
||||
tempBall.x = pointer.x;
|
||||
tempBall.y = pointer.y;
|
||||
} else {
|
||||
var tempBall = new Phaser.Sprite(myGame, pointer.x, pointer.y, 'ball' + Math.round(Math.random() * 5));
|
||||
tempBall.setBoundsFromWorld(Phaser.GameObject.OUT_OF_BOUNDS_KILL);
|
||||
balls.add(tempBall);
|
||||
}
|
||||
tempBall.velocity.y = 150;
|
||||
if(doubleTap) {
|
||||
tempBall.scale.setTo(4, 4);
|
||||
}
|
||||
}
|
||||
function update() {
|
||||
}
|
||||
function render() {
|
||||
myGame.input.renderDebugInfo(16, 16);
|
||||
}
|
||||
})();
|
||||
@@ -1,64 +0,0 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
|
||||
(function () {
|
||||
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
|
||||
|
||||
function init() {
|
||||
|
||||
myGame.loader.addImageFile('ball0', 'assets/sprites/yellow_ball.png');
|
||||
myGame.loader.addImageFile('ball1', 'assets/sprites/aqua_ball.png');
|
||||
myGame.loader.addImageFile('ball2', 'assets/sprites/blue_ball.png');
|
||||
myGame.loader.addImageFile('ball3', 'assets/sprites/green_ball.png');
|
||||
myGame.loader.addImageFile('ball4', 'assets/sprites/red_ball.png');
|
||||
myGame.loader.addImageFile('ball5', 'assets/sprites/purple_ball.png');
|
||||
|
||||
myGame.loader.load();
|
||||
|
||||
}
|
||||
|
||||
var balls: Phaser.Group;
|
||||
|
||||
function create() {
|
||||
|
||||
balls = myGame.add.group();
|
||||
|
||||
myGame.input.onTap.add(tapped, this);
|
||||
|
||||
}
|
||||
|
||||
function tapped(pointer: Phaser.Pointer, doubleTap: bool) {
|
||||
|
||||
if (balls.countDead() > 0)
|
||||
{
|
||||
var tempBall: Phaser.Sprite = <Phaser.Sprite> balls.getFirstDead();
|
||||
tempBall.revive();
|
||||
tempBall.x = pointer.x;
|
||||
tempBall.y = pointer.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
var tempBall: Phaser.Sprite = new Phaser.Sprite(myGame, pointer.x, pointer.y, 'ball' + Math.round(Math.random() * 5));
|
||||
tempBall.setBoundsFromWorld(Phaser.GameObject.OUT_OF_BOUNDS_KILL);
|
||||
balls.add(tempBall);
|
||||
}
|
||||
|
||||
tempBall.velocity.y = 150;
|
||||
|
||||
if (doubleTap)
|
||||
{
|
||||
tempBall.scale.setTo(4, 4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
myGame.input.renderDebugInfo(16, 16);
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -1,19 +0,0 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
(function () {
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
|
||||
function init() {
|
||||
}
|
||||
function create() {
|
||||
// We lock the game to allowing only 1 Pointer active
|
||||
// This means on multi-touch systems it will ignore any extra fingers placed down beyond the first
|
||||
myGame.input.maxPointers = 1;
|
||||
}
|
||||
function update() {
|
||||
}
|
||||
function render() {
|
||||
myGame.input.renderDebugInfo(16, 16);
|
||||
myGame.input.pointer1.renderDebug(true);
|
||||
myGame.input.pointer2.renderDebug(true);
|
||||
myGame.input.pointer3.renderDebug(true);
|
||||
}
|
||||
})();
|
||||
@@ -1,31 +0,0 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
|
||||
(function () {
|
||||
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
|
||||
|
||||
function init() {
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
// We lock the game to allowing only 1 Pointer active
|
||||
// This means on multi-touch systems it will ignore any extra fingers placed down beyond the first
|
||||
myGame.input.maxPointers = 1;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
myGame.input.renderDebugInfo(16, 16);
|
||||
|
||||
myGame.input.pointer1.renderDebug(true);
|
||||
myGame.input.pointer2.renderDebug(true);
|
||||
myGame.input.pointer3.renderDebug(true);
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user