Jump to content

Search the Community

Showing results for tags 'error sprite group example remove exception help'.

  • 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. I 've been following this example on the phaser website https://github.com/photonstorm/phaser-examples/blob/master/examples/groups/remove.js I get the error "Cannot read property 'visible' of undefined" when I remove one of the flasks from the list, I can't seem to see the problem in my code. let gameState = { preload: function () { // new game elements : flask and big flask game.load.image('flask', '/GameHub/Assets/flask.png',40,40); game.load.image('bigflask', '/GameHub/Assets/bigflask.png',180,180); game.load.image('rectangle', '/GameHub/Assets/rectangle.png'); }, create: function () { game.stage.setBackgroundColor(0xFFFFFF); items = game.add.group(); var item; for (var i = 0; i < 4; i++) { item = items.create(90, 16 + 90 * i, 'flask', i); item.name = 'flask' + i; item.inputEnabled = true; item.input.enableDrag(); item.input.enableSnap(90, 90, false, true); item.events.onDragStop.add(dropFlask, this); } var rectangle = game.add.sprite(390, 20, 'rectangle'); rectangle.scale.setTo(2.0, 3.0); var number = game.add.text(570, 30, '0'); var flask5 = game.add.sprite(490, 130, 'bigflask'); } And my drop function as follows: function dropFlask(item, pointer) { if (item.x < 90) { item.x = 90; } else if (item.x > 390){ items.remove(item); }}
×
×
  • Create New...