• Content Count

  • Joined

  • Last visited

About badaf

  • Rank
  • Birthday 04/13/1987

Profile Information

  • Gender
  • Location

Recent Profile Visitors

484 profile views
  1. Thank you for playing, I'm working on physics settings
  2. Here is my first Phaser game, this is an alpha version, I don't named it. This game will be playable in a custom arcade cabinet (this is why resolution is 1280*1024px) It's running at 60fps on my two computers, but I got framerate drops on friends computers... Feel free to give me performance improvements advices ! controls : Left / Right / Jump : spacebar / Crouch : ctrl / Fire : shift Play !
  3. badaf

    Destroying instances

    it's not Game from Phaser.Game, but your trick works for me, thanks
  4. badaf

    Destroying instances

    Thanks, it's difficult to understand these "JS concepts" coming from other oop languages... Another question : if I want to restart my game (destroy all sprites, reset all variables, clear screen, like user pressed F5 ), can I do something like this ? // launch the game 1st time this.myGame = new Game(); // delete this.myGame.destroy(); // launch new game this.myGame = new Game();
  5. Hi all, I'm working on my first Phaser based game, online documentaion is very useful, but I can't find informations about destroying instances. function Enemy(game, layer, x, y, enemyStyle){ var newX = 0; var newY = 0; switch(enemyStyle){ case 'big_guy': newX = x; newY = y-68; break; case 'fast_guy': newX = x; newY = y-24; break; } var mySprite = game.add.sprite(newX, newY, decoType); mySprite.anchor.setTo(0.5, 0.5); layer.add(mySprite); } Enemy.prototype.delete = function(){ mySprite.destroy(); } Here I can destroy the enemy sprite, but not the enemy instance..
  6. solved : function create () { this.gCoins = null; } function update (){ var coins = myLevelManager.getCoins(); for(var i=0; i < coins.length; i++){ this.gCoins = coins[i]; game.physics.arcade.overlap(coins[i].getSprite(), myPlayer.getSprite(), collectCoin, null, this); } } function collectCoin(coin, player){ myLevelManager.deleteCoins(this.gCoins); } it works, but it's ugly....
  7. I'm trying coin.parent.killCoin(); but I get " TypeError: coin.parent.killCoin is not a function "
  8. I'm trying to add some collectable coins : for(var i=0; i < coins.length; i++){ game.physics.arcade.overlap(coins[i].getSprite(), myPlayer.getSprite(), collectCoin, null, this); } Problem, in my callback function, I need to access to "coins", not only to his attached sprite, what can I do ? function collectCoin(coin, player){ coin.killCoin(); // play a "death animation" and destroy itself after 0.4s }
  9. Oh thanks lewster !
  10. Hi all, I'm trying this, this.loopUpdate(), this); I've got this in my Firebug's console :TypeError:[this._i].callback is undefined phaser.min.js (ligne 13, col. 31400) It is the last loop() argument ? How could I fix it ?