Jump to content

Search the Community

Showing results for tags 'bitpam'.

  • 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. Hello everyone, I'm new on this forum and in Phaser. First, I have to say that I've enjoyed using this framework so far, feels very complete; you don't have to implement all the boiler plate for yourself in every game (even sprite already has a `health` attribute), unlike LibGDX (which I have also used in the past). And almost every problem is solved either on this forum, or in examples. But I got a problem in my code that I don't seem able to solve, it might not even be possible to solve, so here it goes. I'm trying to create a sprite from a bitmapData, but then trying to add animations. The reason why I use bitmap is because I want to take advantage of the function replaceRGB and replace some colors (to make different teams), and add the sprite later. If I do this, it works: sprite = game.add.sprite(x, y, 'player'); sprite.animations.add('stand', Phaser.Animation.generateFrameNames('stand/', 1, 1, '.png', 3), 10, true, false); sprite.animations.play('stand'); But, if I try to set the bitmap, it fails on animations.play with this error: phaser.js:69099 Uncaught TypeError: Cannot read property 'index' of undefined at Phaser.Animation.updateCurrentFrame (http://localhost:8000/assets/javascript/lib/phaser.js:69099:36) at Phaser.Animation.play (http://localhost:8000/assets/javascript/lib/phaser.js:68796:14) var bmd = game.make.bitmapData(); bmd.load('player'); bmd.replaceRGB(255,255,255, 255, 250, 0, 0, 255); sprite = game.add.sprite(x, y, bmd); sprite.animations.add('stand', Phaser.Animation.generateFrameNames('stand/', 1, 1, '.png', 3), 10, true, false); sprite.animations.play('stand'); If you inspect the object sprite.animations, will notice that currentFrame is undefined. Is there any way to add the currentFrame afterwards ? or bitmaps are incompatible with animations By the way, my player is a atlasJSONHash game.load.atlasJSONHash('player', 'assets/img/player.png', 'assets/img/player.json'); Thanks in advance.
×
×
  • Create New...