Search the Community

Showing results for tags 'signals'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 6 results

  1. Events / Signals

    Hey guys, Phaser newbie here, need some help with events. How are people dispatching custom events throughout their games. Let's say for example you have 2 classes. Main and Car. Main adds the Car class. The Main class needs to know when the car is low on petrol to update the UI. So would you use Phaser.Signals to handle this communication, or would you just call a function in the Main class directly from the Car class? Are there plans to improve events in Phaser? I understand events can't be global to the Phaser namespace because we need to support multiple Phaser instances, but couldn't events exist globally inside each World instance? All display objects within the World could dispatch and listen for events. Events could bubble up the display list. Does this sound feasible? Thanks! Matt.
  2. mini-runner

    Hey All! Thought you guys might like too check out mini-runner a simple alternative to events and signals with an emphasis on performance. It currently forms the backbone of the messaging system in our game engine. Its working out great for things like update events, collision events etc. Great to use if you are say looping through and array and calling the same function on each object. The resulting code is cleaner than a loop whilst still keeping the performance as fast as possible. So yeah, if you are dispatching signals/events to a lot of listeners often (like everyframe often), then I would considor using this alternative. For most cases, this performace boost is not really important enough to switch from your current fave. Think of this as a nice alternative for when speed really counts! https://github.com/GoodBoyDigital/mini-runner/ Cheers!
  3. Phaser Signal usage & examples

    Hey guys, can you point me at any example usage of Phaser Signals which is a bit more in-depth than a 2-liner? Surprised me how few descriptions i found compared how powerful / important feature it is in Phaser, and how many question admittedly coming on this topic. I read the other link i found What i would be curious: 1. example how to implement publish-subscribe / observers with Signals from player's hero to enemy types & vice-versa, or 2. examples on a general architecture / best practices for broader usage on custom events in a Phaser game, any case study etc. I'm sure i'll come out my own solutions soon, but would really curious how you are using, as relying fully on events are becoming widespread in the wider webdev world, i.e. Flux, Redux Thanks!
  4. Event/Input Executes when defined

    Hey Everyone, I hope someone could help me with this, or if anyone has run into this issue before. I've noticed when I add a signal to an extended sprite, it will be executed immediately. Has anyone run into this issue before? var Card = function(game, x, y, data){ Phaser.Sprite.call(this, game, x, y, 'cardFront'); this.cardName = data.cardName || null; // String this.scale.setTo(0.15,0.15);};Card.prototype = Object.create(Phaser.Sprite.prototype);Card.prototype.constructor = Card;var card = new Card(this.game, 0, 0, {name:'test'});card.input.useHandCursor = true;card.events.onInputOver.add(highlightCard, this, 0, 'arg1', 'arg2');HighlightCard = function(sprite, pointer, arg1, arg2){ console.log('highlight:', sprite, pointer, arg1, arg2);}; Thank you!
  5. Is it good practice to do the following: this.events.onBloomOver = new Phaser.Signal();; Or should the events property be left for Phaser's own events only? And if it's ok - Since I'm using Typescript, how can I get around Webstorm complaining about Unresolved variable onBloomOver - some sort of Interface?
  6. Signals are a light-weight, strongly typed messaging tool and we use them extensively in our game framework. And we’ve just released our TypeScript implementation for others to benefit from. It’s a conversion of js-signals by Miller Medeiros, which is of course in turn a conversion of AS3-Signals by Robert Penner. You can get TypeScript-Signals from github. If you are unfamiliar with Signals, how they work and how they compare to Events then this short summary is well worth a quick read, but to summarise: A Signal is essentially a mini-dispatcher specific to one event, with its own array of listeners.A Signal gives an event a concrete membership in a class.Listeners subscribe to real objects, not to string-based channels.Event string constants are no longer needed.Signals are inspired by C# events and signals/slots in Qt. I ported over all of the 18 unit tests to TypeScript as well. So you have plenty of examples: from adding a basic listener up to manual binding and dynamic context switching. http://www.photonstorm.com/archives/9826/typescript-signals-released-think-outside-the-event