Jump to content

Search the Community

Showing results for tags 'click sprite'.

  • 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. var MapObjects = {}; function setupMapObjects() { MapObjects.chest = new PIXI.Sprite(frame("images/chest.png", 0, 0, 50, 50)); MapObjects.chest.x = 200; MapObjects.chest.y = 200; MapObjects.chest.anchor.x = 0.5; MapObjects.chest.anchor.y = 0.7; MapObjects.chest.interactive = true; MapObjects.chest.on('click', openChest); MapObjects.chest.hitArea = new PIXI.Circle(MapObjects.chest.x, MapObjects.chest.y, 10); MapObjectsArray.push(MapObjects.chest); stage.addChild(MapObjects.chest); }; function openChest() { console.log('open'); }; var Player = {}; function setupPlayer(){ Player.sprite = new PIXI.Sprite(frame("images/Player.png", 0, 0, 128, 128)); Player.sprite.anchor.x = 0.5; Player.sprite.anchor.y = 0.7; Player.sprite.x = 150; Player.sprite.y = 150; Player.vx = 0; Player.vy = 0; Player.direction; Player.directionIdle; Player.idle; Player.moving; Player.frameCycle = 0; Player.action = false; Player.run = false; Player.melee = false; Player.sprite.interactive = true; Player.sprite.on('click', openChest); stage.addChild(Player.sprite); }; MapObjects.chest does not respond to the .on('click', openChest) but Player.sprite does. I don't know man.... I just don't know. I marked this off my To Do list a few days ago cause it was working but now... (head explodes) I guess I should ask if there is another way to apply the click event to the sprite.
×
×
  • Create New...