Jump to content

Phaser with external menu system


charlie_says
 Share

Recommended Posts

Has anyone any experience of passing in external events to Phaser?

I'm making a game, which Phaser will work very well for, but as part of the design there may need to be an external menu - this will navigate to various parts of the game.  Generally the phaser examples are pretty self contained, and I think this request is slightly out of the ordinary.

Could I send a phaser signal on the menu click and capture that within my game?

 

Link to comment
Share on other sites

In one of my games runs into an angular application.

When the player reached highscore, I take a print out of the canvas and send the image to the server. However, this action was triggered by the game(phaser canvas), not by the angular app.

// get angular scope
this._scope = angular.element($('ion-view')).scope();

// call controller function
this._scope.ShareRanking(this._game);

in angular controller:

$scope.ShareRanking = function(game)
{
	$scope.rankingImage = game.canvas.toDataURL();	

	// bla bla bla ...

Just do the same by adapting the code to, whatever it is using outside the phaser.

scope:
javascript.app {
    phaser.app
}

Just pick up the variable / function.

outside canvas:

var foo = function (param) {console.log ('done!', param)}

inside:

foo('yeah!');

Sorry for my shit English.

I hope I have helped! = D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...