MackTuesday

Members
  • Content count

    5
  • Joined

  • Last visited

  1. Multiple game states with common UI

    Awesome. Thanks again.
  2. Multiple game states with common UI

    Thanks. So for example I would add a sprite to the stage instead of the world with var whatever = game.add.sprite(x, y, 'whateverKey', null, game.stage); right? Or should the frame be 0 instead of null? The code seems to indicate either will work, but I might have misinterpreted what I saw in the listings.
  3. Multiple game states with common UI

    The game I'm working on has the screen divided into a few frames. The contents of the frames can change depending on game state, but the layout -- borders, border art, frame sizes and positions -- always stays the same. If I have a global layout building function that all states share, is that an acceptable design? Is there a better way?
  4. var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update}); function preload() { game.load.image('Stars', 'assets/Stars.png'); game.load.spritesheet('enemy', 'assets/enemy.png'); game.load.spritesheet('Demon', 'assets/The Blood Demon.png'); game.load.spritesheet('bullet', 'assets/fireball.png'); game.load.spritesheet('Rlaser', 'assets/red laser.png'); game.load.spritesheet('boom', 'assets/explosion3.gif'); game.load.audio('Falcon', 'assets/audio/laserSFX.mp3' ); } var boom; var enemy; var Rlaser; var sprite; var weapon; var cursors; var fireButton; var Demon; var bullet; var Falcon; var back; var back2; var Stars; var anim; var loopText; var counter = 0; var keys; function create() { // Our bullet group bullets = game.add.group(); bullets.physicsBodyType = Phaser.Physics.ARCADE; bullets.enableBody = true; bullets.createMultiple(30, 'bullet'); bullets.setAll('anchor.x', 0.5); bullets.setAll('anchor.y', 1); bullets.setAll('outOfBoundsKill', true); bullets.setAll('checkWorldBounds', true); weapon = game.add.weapon(20, 'bullet'); weapon.bulletKillType = Phaser.Weapon.KILL_WORLD_BOUNDS; weapon.bulletAngleOffset = 90; weapon.bulletSpeed = 400; sprite = this.add.sprite(320, 500, 'Demon'); //game.physics.arcade.enable(sprite); // The enemies enemy = game.add.sprite(320, 100, 'enemy'); enemy.enableBody = true; enemy.physicsBodyType = Phaser.Physics.ARCADE; // Tell the Weapon to track the 'player' Sprite, offset by 14px horizontally, 0 vertically weapon.trackSprite(sprite, 14, 0); fireButton = this.input.keyboard.addKey(Phaser.KeyCode.SPACEBAR); // this is the code for the laser when firing Falcon = game.add.audio('Falcon'); } function collisionHandler (bullet, enemy) { console.log("collision!"); // When a bullet hits an enemy we kill them both } function update() { // Run collision console.log(game.physics.arcade.overlap(enemy, bullets, collisionHandler, null, this)); // this link sthe firbutton and laser sound effect if (fireButton.isDown) //error? { weapon.fire(); Falcon.play(); } } The space key makes the weapon fire. That works fine. And the when the weapon fires, I get a sound. Good. But the bullet goes right through enemy. What's going on?
  5. Tools compatible with Phaser

    I'm going to resurrect this thread rather than make a new one. (Or should I have just made a new one?) Things change so quickly, this thread being a year old, I can't help but wonder if any of these tools have been dropped in favor of newer ones. I'm brand new to Phaser so I don't have any information of my own to share, unfortunately, except that Physics Body Editor seems to be a viable free alternative to PhysicsEditor. What are other people using? Addendum: I found this more recent thread, but it doesn't talk about physics editors.