Jump to content

Search the Community

Showing results for tags 'detecting blank touch'.

  • 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 all, I am a game designer and was mostly working with construct2 and very new to PhaserJS so please forgive my "super-simple" sometimes even trivial questions. Here's the question I have two images taken out of same spritesheet using the json atlas map. In this case both the stars are in yellow in color. Now when you click on any one of the stars the star turns grey which I am able to do using the event listener of the mouse input function. Same works independently for the other sprite as well. Now I want to make it like the following : " when we click on one star the other star should automatically get unselected AND when we click anywhere on the screen apart from the sprite, the all the sprites in the screen should automatically get unselected" The point is at any given time only one sprite should be in SELECTED state. Something like this : http://collegetomato.com/query_on_selectionandUnselection.jpg Following is my "NOOB" code You can forgive me for my simple question as I am basically a designer and trying some hand on coding. <!doctype html> <html> <head> <title>Phaser</title> <script type="text/javascript" src="js/phaser.min.js"></script> </head> <body> <script type="text/javascript">var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update }); function preload() { game.load.atlasJSONHash('starJSON', 'assets/stars.png', 'assets/stars.json'); } function create() { sprite = game.add.sprite(20,20,'starJSON',2); sprite2 = game.add.sprite(400,20,'starJSON',2); //sprite3 = game.add.sprite(60,20,'starJSON',2); sprite.inputEnabled=true; sprite.events.onInputDown.add(spriteInputListener,this); sprite2.inputEnabled=true; sprite2.events.onInputDown.add(spriteInputListener2,this); // sprite3.inputEnabled=true; // sprite3.events.onInputDown.add(spriteInputListener3,this); } function update() { } function spriteInputListener() { sprite.destroy(); game.add.sprite(sprite.x ,sprite.y,'starJSON',1);} function spriteInputListener2() { game.add.sprite(sprite2.x,sprite2.y,'starJSON',1);} // function spriteInputListener3() { // game.add.sprite3(60,20,'starJSON',1);//}</script></body></html>Thanks
×
×
  • Create New...