Help: HTML5GameDevs: YuShaN 2
http://www.html5gamedevs.com/topic/18073-trouble-with-getfirstexists/
by chongdashu
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.4.4/phaser.js"></script>
JavaScript
BasicGame = {};
BasicGame.Game = function (game) {
// When a State is added to Phaser it automatically has the following properties set on it, even if they already exist:
this.game; // a reference to the currently running game
this.add; // used to add sprites, text, groups, etc
this.camera; // a reference to the game camera
this.cache; // the game cache
this.input; // the global input manager (you can access this.input.keyboard, this.input.mouse, as well from it)
this.load; // for preloading assets
this.math; // lots of useful common math operations
this.sound; // the sound manager - add a sound, play one, set-up markers, etc
this.stage; // the game stage
this.time; // the clock
this.tweens; // the tween manager
this.world; // the game world
this.particles; // the particle manager
this.physics; // the physics manager
this.rnd; // the repeatable random number generator
// You can use any of these from any function within this State.
// But do consider them as being 'reserved words', i.e. don't create a property for your own game called "world" or you'll over-write the world reference.
this.background;
this.player;
this.playerBullet;
this.playerBulletGroup;
this.shoot;
this.enemy;
this.enemyGroup;
this.cursors;
this.bulletTimer = 0;
this.enemyTimer;
};
BasicGame.Game.prototype = {
preload: function () {
this.game.load.crossOrigin = 'anonymous';
this.game.load.image("bullet", "http://i.imgur.com/oS5Q1Jx.png");
this.game.load.image("lunaBullet", "http://i.imgur.com/oS5Q1Jx.png");
this.game.load.image("cirno", "http://i.imgur.com/9e9tX9W.png");
this.game.load.image("luna", "http://i.imgur.com/CD5TrXo.png");
this.game.load.image("background", "http://i.imgur.com/9ElFSZR.png");
},
create: function () {
// -- my own debug
...