gambler Posted March 18, 2016 Share Posted March 18, 2016 I am developing game, in that i want to display a pop which is made in html. When i click an image then popup should come on background. Link to comment Share on other sites More sharing options...
benlooi Posted March 18, 2016 Share Posted March 18, 2016 There are several ways to display a modal or pop up, using CSS libraries like Bootstrap and Semantic UI. So, for example, if you have a sprite, you need to first enable Input on it within Create, then handle the event when it is clicked. The event will then call a function, and within the function, you display the pop up. var sprite; function create () { sprite=game.add.sprite( X, Y, 'mySprite'); sprite.inputEnabled=true; //enable input on the sprite; sprite.events.onInputDown.add(showPopUp, this) ; //set what function to do when it is clicked; } function showPopUp ( ) { $('.ui.modal').modal('show'); //JQuery method to call the modal in Semantic UI. } Of course, in your index.html, you should link the scripts to your head portion. Link to comment Share on other sites More sharing options...
cardex107 Posted March 18, 2016 Share Posted March 18, 2016 Hello, the possible solution can be js or jquery, but the interactivity will be lost with the (canvas) game, it's better put elements in layers, groups or others, and change states for this visible or not (simply without animations). At the beginning: overlay.visible = false; For use: overlay.visible = true; Or look this for animate: https://developer.mozilla.org/en-US/docs/Games/Tutorials/2D_breakout_game_Phaser/Animations_and_tweens Link to comment Share on other sites More sharing options...
Recommended Posts