NewGuy

Members
  • Content Count

    32
  • Joined

  • Last visited

Everything posted by NewGuy

  1. Hmm, my bad, looks like Pivot does still exist but it's PIXI.DisplayObject.pivot. Anywho, it'd still be interesting to hear anyone's performance related experience with Phaser.Graphics / Phaser.Images?
  2. g'day g'day I've been lurking around a few forum posts addressing anchoring with Phaser Graphics objects and why you can't do it. I gathered it was something to do with it being a lower level issue with Pixi (don't quote me on that) the solution for dealing with this seemed to come down to either using pivot or generateTexture() and loading into image / sprite. Since it looks like post 2.5.0 we've lost Phaser.Graphics.pivot, I was wondering if there was any performance loss / gain by calling generateTexture() and loading into a Phaser.Image / Phaser.Sprite and anchoring from there? I guess simply put, is it cheaper to have 10 Phaser.Graphics or 10 Phaser.Images? ( bonus points for shedding light on what happened to pivot )
  3. Seems like a nice shorthand method, yeah I know I don't need to go all out but I like the structured approach to the loader. Again, just personal preference I think at that point, not sure there's a gain/loss to either method? (if there is pls tell me)
  4. Ah thankyou! That would makes sense, my only other idea was that the JSON either didn't exist or was failing at times, hmmm ... As to how I load, my understanding was there was no actual loading going on until you called game.load.start() so my general flow is create (state started) > prepare load stack > load start > on load complete, move on to next state. That to me just seems a little more structured, probably just personal preference in the end, however.
  5. Hi all, for the record have seen a similar post before but it was quite different to my scenario. I have a pretty generic set up. I have a loading screen state where I subscribe to the onLoadComplete signal which 99.9% of the time seems to be running fine. However, over night I had a Raygun (error reporting tool) error pop up with one of our users managing to get a null version number! It is loaded like so ... public create() { this.game.load.onLoadComplete.add(this.loadComplete, this); this.game.load.json("buildInfo", "assets/json/buildinfo.json"); ... } ... public loadComplete() { buildInfo = this.game.cache.getJSON("buildInfo"); Raygun.setVersion("somegame_" + buildInfo.version); ... } The error occurs at "Raygun.setVersion("somegame_" + buildInfo.version);" as buildInfo is undefined. I assume this is some silly load time thing, or perhaps something to do with the way I use getJSON? It's a rare occurrence but it has happened! thought I'd see if anyone with a deeper knowledge of Phaser could fire a few possibilities my way. Thanks!
  6. Not quite @Arcanorum! It was a weird scenario. I was building a class that took any Phaser.Button as a parameter and draws the progress arc around the button. The idea was to allow you to tap the button or do another action that would fill the progress bar and fire off the targeted button's callback when the bar was full. My original issue was I didn't have visibility of the targeted button's callback BUT I found out through reading the Phaser source that the callback is added to the inputUp signal be default. <wall/>
  7. NewGuy

    button help!

    var button = this.game.add.button(game.world.centerX, 500, 'button', action, this, 0,0,0); button.scale.setTo(0.5); function action() { move(); } function move(){ alert("button pressed"); tweenA = game.add.tween(wr1).to({x:400}, 2000); } Try this? Kinda hard to know where you're working from
  8. Pardon me, it's a long story but I'm working with a workmate's old code and he wrote a middle class that changed the signal used for calling the callback. Samme's method does work.
  9. Hey, samme. I managed to get as far as 'btn.onInputUp.dispatch()' by looking at the source. Unfortunately yours didn't work, hmmm if (callback !== null) { this.onInputUp.add(callback, callbackContext); } And as far as I could tell it looks like you'd just need to call dispatch since it has the function and the context right? Something missing
  10. Probably a silly question, I'm wondering if there's a way to get a Phaser.Button to fire off it's callback externally? I'm basically writing a wee class with a progress bar that attaches to Phaser.Button's and when the progress bar is full, I'd like it to provoke the button to call it's callback. Any ideas? (My next plan was making an extension of Phaser.button that's hold a reference to the button's callback but I'd like to avoid doing that)
  11. I don't believe Phaser has anything like this built in, however I found a couple of plugins that might be what you're looking for. http://jdnichollsc.github.io/Phaser-Kinetic-Scrolling-Plugin/ http://zynga.github.io/scroller/
  12. Yes, thankyou @mattstyles @sammethat was helpful. I'll get debuggin I guess!
  13. Hmmm, already using CANVAS renderer
  14. Hello again, all. Started project recently which seems simple enough and difficult to screw up, however, on our Apple devices I'n noticing over about the period of 30 minutes or so, the frame rate drops from 60 to under 20! I'm keeping an eye on instances in the world and they don't increase over time. I thought I had it well contained but it would appear I was wrong. I guess my questions is, what other things need manual keeping? My sprites/images are well contained I believe, could sounds not being destroyed be the cause? Cheers for any help
  15. Cool, thanks. Is there any decent method for detecting when audio is decoded? We obviously have the onLoadComplete signal but it's always been problematic say, when kicking up a music file straight after the loading screen. It would be cool to factor some decode time accurately into load time.
  16. Hello again, team. I was wondering if anybody has experience in doing quick, on the fly loading / unloading. This case mostly targeting audio assets. I'd like to know if Phaser has problems with this and / or if there are better ways to approach my problem. Quick doodle of what was in my brain but is there an issue with this loading style? Let's say I have A - Z in .mp3 files. I would like to play A, load B, then play B, load C and so on. (while also unloading as I go) Any replies welcome, cheers!
  17. @mattstyles @carlosnufe Awesome repl! You really went above and beyond to explain which is great. Based on what you've said I don't think the issues I'm having might not be related to a overloaded cache or anything. I have a lot of audio files I'm autodecoding onload at the start of my game and when I prevented the audio loading the performance went back to normal. What I don't understand is why, even when audio isn't always playing, would loading / decoding audio cause my game to be permanently jittery? The issue occurs on an iPad 4 specifically if this gives any extra insight? (Devices such as Samsung Tab S2 for example perform great) pps. I'm using a Cordova setup for iOS / Android dev
  18. (Not sure if there is a better place to post but here it goes) Hello again, devs.This is a general question that I'd anyone to reply to mostly regarding when you load your assets. I'm interested to know if people mostly bulk load in some loading screen state or get clever and do on the fly loading (if this is even possible?) or even something like level to level asset loading/unloading. This may be a bit of an odd post but I'd really like to see how other get the job done, as at the moment I'm having performance issues which I'm fairly sure is due to how I load mine (one bulk load on a loading screen, then onLoadComplete I move on) Cheers
  19. Thanks, Rich. I moved the player to the flag pool and the ordering works and that's all I need. Thanks for replying.
  20. Thanks for replying, Rich! Also sorry because I didn't explain myself properly . . at all. The idea is I want the flags to move infront/behind the player, this in my mind required creation order be foreground group> player > background group and I'd move the flags from foreground to background and my issue was the flags already reside in their object pool. I hacked a solution where I created my player inside the flag pool and sorted on the y like you said and that worked. Feel like that's a bit gross, though. Hope that made a little more sense? (:
  21. Hello again, guys. I've seen quite a few questions on here addressing object depth and ways of sorting their depth order and whatnot, but so far I'm yet to get a nice solution to my problem. I'll lead with an image; What we have here is my attempt at a 2.5D type game, where the purple rectangle represents the player, the red lines show the perspective and the green lines are trying to demonstrate the depth of the flags coming towards the player. My issue is simple but quite important for the mechanics of the game, the flags move towards the player and the player zig zags around them (like Slalom skiing!), my issue is I need to have the flags behind the player and then once past the dotted line (foot of the player) they move to in front of the player. I've seen techniques that involve moving the items back and forth from a background and foreground group, I take issue with this method as I recycle my flags (object pooling) and their place in the pool group is important and I'm not sure if I can move them through another group without stuffing with my pooling. I think I've explained the problem, any body have a suggestion or solution? Any words welcomed! (ps. sorry for wall of text)
  22. This was more to what I was looking for, thanks, drhayes.
  23. Late response, sorry! This wasn't what I was looking for but ended up being a really cool idea that I essentially implemented. You guys are all awesome. (:
  24. So far I've implemented essentially what I wanted. Still feels like a hack in a way ... export class EventController { eventInProgress: boolean; currentEvent: number; currentDifficulty: number; currentProgress: number; updateFrequency: number; constructor(private _game) { this.eventInProgress = false; this.currentEvent = 0; this.currentDifficulty = 0; this.updateFrequency = 1; //Time in seconds between updates //Whipped up a game loop _game.time.events.loop(Phaser.Timer.SECOND * this.updateFrequency, this.eventUpdate, this); } eventUpdate() { this.currentProgress = Math.floor(_game.scrollTotal); console.log(this.currentProgress.toString() + " meters!"); } ...It works well enough and it also allows you to adjust how often the update goes off. I'd still like to hear if there is a more proper way of adding the world update to classes?
  25. Hey, people. Weird question, I'd like to build a class 'EventController' who will, in the long run, control things like timing, item spawning, special events etc. and I feel like having an update method would be appropriate, however, I don't believe the world picks up the Update method for any old class and I'd like to avoid simply extending a class that has an update. (or is this my only option) I guess my question is how can I subscribe my classes to the world update OR maybe a suggestion for a more personal timer to the class perhaps? (I've considered just having a timer that periodically goes off and does checks there?) Any words welcomed!