mirror of
https://github.com/wassname/phaser.git
synced 2026-08-14 12:40:17 +08:00
Final 0.9.4 release
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
(function () {
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
|
||||
function init() {
|
||||
myGame.loader.addTextFile('jsontest', 'assets/maps/test.json');
|
||||
myGame.loader.addImageFile('jsontiles', 'assets/tiles/platformer_tiles.png');
|
||||
myGame.loader.load();
|
||||
}
|
||||
var car;
|
||||
var map;
|
||||
var hasGrabbed = false;
|
||||
function create() {
|
||||
myGame.camera.deadzone = new Phaser.Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
|
||||
map = myGame.createTilemap('jsontiles', 'jsontest', Phaser.Tilemap.FORMAT_TILED_JSON);
|
||||
// for now like this, but change to auto soon
|
||||
myGame.world.setSize(map.widthInPixels, map.heightInPixels);
|
||||
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
|
||||
car = myGame.createSprite(300, 100, 'car');
|
||||
myGame.camera.follow(car);
|
||||
}
|
||||
function update() {
|
||||
car.velocity.x = 0;
|
||||
car.velocity.y = 0;
|
||||
car.angularVelocity = 0;
|
||||
car.angularAcceleration = 0;
|
||||
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
|
||||
car.angularVelocity = -200;
|
||||
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
|
||||
car.angularVelocity = 200;
|
||||
}
|
||||
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
|
||||
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
|
||||
car.velocity.copyFrom(motion);
|
||||
}
|
||||
if(myGame.input.keyboard.justReleased(Phaser.Keyboard.SPACEBAR) && hasGrabbed == false) {
|
||||
console.log('graboids');
|
||||
hasGrabbed = true;
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -1,67 +0,0 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
|
||||
(function () {
|
||||
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
|
||||
|
||||
function init() {
|
||||
|
||||
myGame.loader.addTextFile('jsontest', 'assets/maps/test.json');
|
||||
myGame.loader.addImageFile('jsontiles', 'assets/tiles/platformer_tiles.png');
|
||||
|
||||
myGame.loader.load();
|
||||
|
||||
}
|
||||
|
||||
var car: Phaser.Sprite;
|
||||
var map: Phaser.Tilemap;
|
||||
var hasGrabbed: bool = false;
|
||||
|
||||
function create() {
|
||||
|
||||
myGame.camera.deadzone = new Phaser.Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
|
||||
|
||||
map = myGame.createTilemap('jsontiles', 'jsontest', Phaser.Tilemap.FORMAT_TILED_JSON);
|
||||
|
||||
// for now like this, but change to auto soon
|
||||
myGame.world.setSize(map.widthInPixels, map.heightInPixels);
|
||||
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
|
||||
|
||||
car = myGame.createSprite(300, 100, 'car');
|
||||
|
||||
myGame.camera.follow(car);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
car.velocity.x = 0;
|
||||
car.velocity.y = 0;
|
||||
car.angularVelocity = 0;
|
||||
car.angularAcceleration = 0;
|
||||
|
||||
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
|
||||
{
|
||||
car.angularVelocity = -200;
|
||||
}
|
||||
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
|
||||
{
|
||||
car.angularVelocity = 200;
|
||||
}
|
||||
|
||||
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
|
||||
{
|
||||
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
|
||||
|
||||
car.velocity.copyFrom(motion);
|
||||
}
|
||||
|
||||
if (myGame.input.keyboard.justReleased(Phaser.Keyboard.SPACEBAR) && hasGrabbed == false)
|
||||
{
|
||||
console.log('graboids');
|
||||
hasGrabbed = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -7,6 +7,7 @@
|
||||
myGame.loader.addImageFile('tiles', 'assets/tiles/platformer_tiles.png');
|
||||
myGame.loader.addImageFile('ufo', 'assets/sprites/ufo.png');
|
||||
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
|
||||
myGame.loader.addImageFile('chunk', 'assets/sprites/chunk.png');
|
||||
myGame.loader.load();
|
||||
}
|
||||
var map;
|
||||
@@ -27,10 +28,10 @@
|
||||
]);
|
||||
emitter = myGame.createEmitter(32, 80);
|
||||
emitter.width = 700;
|
||||
emitter.makeParticles('melon', 100, 0, false, 0);
|
||||
emitter.makeParticles('chunk', 100, 0, false, 1);
|
||||
emitter.gravity = 200;
|
||||
emitter.bounce = 0.8;
|
||||
emitter.start(false, 10, 0.1);
|
||||
emitter.start(false, 10, 0.05);
|
||||
car = myGame.createSprite(250, 64, 'ufo');
|
||||
car.renderRotation = false;
|
||||
test = myGame.createSprite(200, 64, 'ufo');
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
myGame.loader.addImageFile('tiles', 'assets/tiles/platformer_tiles.png');
|
||||
myGame.loader.addImageFile('ufo', 'assets/sprites/ufo.png');
|
||||
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
|
||||
myGame.loader.addImageFile('chunk', 'assets/sprites/chunk.png');
|
||||
|
||||
myGame.loader.load();
|
||||
|
||||
@@ -34,10 +35,10 @@
|
||||
|
||||
emitter = myGame.createEmitter(32, 80);
|
||||
emitter.width = 700;
|
||||
emitter.makeParticles('melon', 100, 0, false, 0);
|
||||
emitter.makeParticles('chunk', 100, 0, false, 1);
|
||||
emitter.gravity = 200;
|
||||
emitter.bounce = 0.8;
|
||||
emitter.start(false, 10, 0.1);
|
||||
emitter.start(false, 10, 0.05);
|
||||
|
||||
car = myGame.createSprite(250, 64, 'ufo');
|
||||
car.renderRotation = false;
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
(function () {
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
|
||||
function init() {
|
||||
myGame.loader.addImageFile('atari', 'assets/sprites/atari130xe.png');
|
||||
myGame.loader.load();
|
||||
}
|
||||
var atari;
|
||||
function create() {
|
||||
atari = myGame.createSprite(300, 0, 'atari');
|
||||
startBounceTween();
|
||||
}
|
||||
function startBounceTween() {
|
||||
atari.y = 0;
|
||||
var bounce = myGame.createTween(atari);
|
||||
bounce.to({
|
||||
x: 2
|
||||
}, 1000 + Math.random() * 3000, Phaser.Easing.Bounce.Out);
|
||||
bounce.onComplete.add(startBounceTween, this);
|
||||
bounce.start();
|
||||
}
|
||||
})();
|
||||
@@ -1,36 +0,0 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
|
||||
(function () {
|
||||
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
|
||||
|
||||
function init() {
|
||||
|
||||
myGame.loader.addImageFile('atari', 'assets/sprites/atari130xe.png');
|
||||
|
||||
myGame.loader.load();
|
||||
|
||||
}
|
||||
|
||||
var atari: Phaser.Sprite;
|
||||
|
||||
function create() {
|
||||
|
||||
atari = myGame.createSprite(300, 0, 'atari');
|
||||
|
||||
startBounceTween();
|
||||
}
|
||||
|
||||
function startBounceTween() {
|
||||
|
||||
atari.y = 0;
|
||||
|
||||
var bounce: Phaser.Tween = myGame.createTween(atari);
|
||||
|
||||
bounce.to({ x: 2 }, 1000 + Math.random() * 3000, Phaser.Easing.Bounce.Out);
|
||||
bounce.onComplete.add(startBounceTween, this);
|
||||
bounce.start();
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user