Jump to content

Search the Community

Showing results for tags 'phaser animations onComplete'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Hi Guys, After several experiments I decided to use Phaser for my framework to build me my first html5 game. When piecing my game together I have some troubles using animations. My game is a molehunt clone. My create function creates a group which has 9 molehill sprites. Each sprites has the same animations from an empty molehill to a mole who's waiting for the action. In my update function I have some code which determens if a new mole has to pop out and where. What I want to achieve is that a mole is chosen to begin, it will get a delay before the animation of the popping out starts, en when that animation is ready it gets a new delay before the going away animation is started. Because I wanted to take one step at a time I wanted to try out te concept without the delays, but for some reason I can't set the onComplete of the animation to my startMole function. I get the following error: Uncaught TypeError: Cannot read property 'add' of undefined Here's pieces of my code: buildMoles: function() { console.log('buildMoles'); this.molegroup = this.add.group(); this.molegroup.enableBody = true; for(var i=0; i<this.totalMoles; i++) { var m = this.molegroup.create(900, 200, 'mole'); m.anchor.setTo(0.5, 1); m.body.moves = false; anim = m.animations.add('molehill', [0]); m.animations.add('mole_peek_out', [0,1,2,3,4]); m.animations.add('mole_peek_in', [4,3,2,1,0]); m.animations.add('mole_go_out', [0,1,2,3,4,5,6,7]); m.animations.add('mole_go_in', [7,6,5,4,3,2,1,0]); m.animations.play('molehill', 24, false); // console.log(m); } this.prepareLevel(); }, startBunny: function(m) { m.animations.stop('molehill'); m.onComplete.add(this.stopBunny, this); m.animations.play('mole_go_out', 24, false); }, update: function() { // ... if (this.freeMoles > 0) { var whichMole = this.rnd.integerInRange(0, this.maxMoles-1); if (this.molesInPlay[whichMole] == 0) { this.molesInPlay[whichMole] = 1; m = this.molegroup.children[whichMole]; this.startMole(m); this.freeMoles--; console.log(this.molesInPlay); console.log(this.freeMoles); } } // ... }, I'm sure I'm going about this the wrong way, but for now I don't have a clue what to try next. Maybe there's someone who can help me? Thanks in advance! Roger
×
×
  • Create New...