Zampano

Members
  • Content Count

    59
  • Joined

  • Last visited

About Zampano

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Zampano

    Group Alpha

    Hey everyone. Is there a possibility to use something like a "master alpha" for a group of sprites instead of them all having their individual alphas changed? If that's not clear enough: I have a group of overlapping sprites that make up a bigger element. Now I want to fade this in/out as one single object using a tween. Instead, the sprites fade individually which results in them overallbeing less transparent in overlapping areas as well as initially covered sprites to shine through for the duration of the fade. Obviously, I could alternatively just make it all one sprite, but due to multiple possible combinations, that would be quite costly. Does anyone have an idea? Thanks! EDIT: After some more research, I think rendertexture might be what I need, right?
  2. Zampano

    No AudioContext in IE?

    I'm not 100% sure what those would be but I don't think I'm using them 🙈
  3. Zampano

    No AudioContext in IE?

    Okay, thanks, but do I need to care about that in any way or can I just ignore the whole thing?
  4. Zampano

    No AudioContext in IE?

    Hey everyone, I just recently discovered that in IE, audio context is null. I gotta admit I do not fully understand what audio context even means or does, so I'm unsure if that's a problem for me as I rely on the playback position of the audio track for some of my code among other things. What can or should I do about it?
  5. Thanks for posting your solution, I'm having the same problem despite using phaser 2.10.4. However, I am using multiple states for my game and I'm not sure where to put the code. In every state?
  6. Hey, I'm trying to tint some of my bitmapText chars. I do this inside of my create function: this.intro_text = this.add.bitmapText(640, 280, 'linotte_basic_white_22', text, 20); this.intro_text.maxWidth = 360; this.intro_text.tint = 0xf80f6a; //Tried removing that as well this.intro_text.align = "center"; this.intro_text.alpha = 1; this.intro_text.anchor.setTo(0.5, 0); for(var i = 0; i < 18; i++) { this.intro_text.children[253+i].tint = 0x000000; } The text is now fully colored in 0xf80f6a. If I put the for loop on a timer of 1 ms, it works. That's quite an easy workaround, but I wonder why it is even necessary 😐
  7. Zampano

    Extending Phaser functions

    Okay, I didn't want to do the first in case there were any updates or fixes. The second one will do fine, thank you!
  8. Zampano

    Extending Phaser functions

    Hey everyone, I want to attach some additional code to Phaser.Tween.start. I realize I could do Phaser.Tween.prototype.start_custom = function () { console.log("Custom Code"); Phaser.Tween.prototype.start.call(); } But couldn't I also do it without creating a separate function? I can't find anything really helpful on it and although I realize it's pretty basic, I have no idea on how to actually do it Any help is greatly appreciated.
  9. Zampano

    PhysicsElapsed & Monitor Refresh rate

    I see. But the monitor's refresh rate seems to put a cap on it, I don't have 144 logic updates on my 60hz monitor as far as I can tell. So can I just globally leave it at 144 or would it be better for performance to put a system in place that checks the max fps and adjusts desiredFps accordingly in common refresh rate steps?
  10. Zampano

    PhysicsElapsed & Monitor Refresh rate

    Oh. It actually works. But I don't exactly get why it does... and moreso, why is it even there in the first place then and not "set to infinite"? And I guess this also means that 30hz monitors wouldn't have that problem, doesn't it?
  11. Hey guys, I had related topics before, but let me give a short summary: I am working on a time-based game, roughly similar to guitar hero. For that, I use deltaTime and PhysicsElapsed like this: update: function() { deltaTime = (this.time.elapsedMS)/(1000/60) this.time.physicsElapsed = this.time.elapsedMS*0.001; } So if the framerate drops to 30, deltaTime = 2 and physicsElapsed will also be double the value it is normally (1/60 as in 1/desiredFPS). It always seemed to work perfectly fine. Sure, it leads to a loss of accuracy whith lower framerates or bigger lags, but that's another story. I've tested it with 30fps (forced with a screen capture tool) and it was running at the same speed as it would with 60, so everything is alright. Just yesterday, I found out that when played on a 144hz monitor, the game runs in slow motion. I've checked all the vars above, and I could not find a problem. The game runs at 144 fps, deltaTime is around 0.42 as it should be and physicsElapsed naturally also has the value I expected (0.006999999999999999 for example). But all the motions are at half speed. Or more like 0.42x speed. The spawns, which are also tied to the game time are correct, so no problems there, but everything just moves too slow. The big mistery is: if somebody has a 30hz display, will it run at double speed which wouldn't be playable at all? I just can't think of a reason why this would happen as everything works fine with software caused differences in fps and especially since all the values seem to be in check. Maybe I am overlooking something? Maybe the hardware has some other effect that takes place outside of my code logic? I read that there are issues with other refresh rates, but I was under the impression my code would take care of that. Please help D:
  12. Zampano

    Global key event in all states

    Hey there, I'm trying to get a key to always call a certain function, regardless of which state my game is in. At the moment, my code is this: var escKey = null BasicGame.Boot = function (game) { //... }; BasicGame.Boot.prototype = { init: function () { escKey = game.input.keyboard.addKey(Phaser.Keyboard.ESC); escKey.onDown.add(function(){console.log("esc")}, game); } And so on. escKey stays defined in all states, but onDown doesn't trigger. If I move the two lines within init to a state, I can use ESC in that state, but not in any state after that. Is there a way to do this?
  13. Zampano

    Stop and restart a tween/recycling tweens

    I think that's a good idea. I had quite some trouble finding out that the "problem" is kind of intended, especially since isRunning was true.
  14. Zampano

    Stop and restart a tween/recycling tweens

    Thank you both! Tom's approach was more like it since I want to use the exact tween again and not delete it's properties. I ended up doing it like this: Phaser.Tween.prototype.removeFromUpdateQueue = function () { var i = this.manager._tweens.indexOf(this); if (i !== -1) { this.manager._tweens.splice(i, 1); } else { i = this.manager._add.indexOf(this); if (i !== -1) { this.manager._add.splice(i, 1); } } } Phaser.Tween.prototype.skip = function () { if(this.isRunning || this.isPaused) { this.isRunning = this.isPaused = false; this.onComplete.dispatch(this.target, this); this._hasStarted = false; this.removeFromUpdateQueue(); var propnames = Object.keys(this.properties); for (var i = 0; i < propnames.length; i++) { this.target[propnames[i]] = this.properties[propnames[i]]; } } return this; }
  15. Hey guys, I've run into yet another case of "don't know how to do this best" and I'm looking for help Here's my Scenario: I've got a sprite with a certain tween. The tween is supposed to be skippable, which means it stops and all properties of the sprite will be set to the target values of the tween and the onComplete function will be fired. After that, it can be played again and so on. Here's the Tweens setup: this.portrait.inFocus = false; this.portrait.focusTween = this.add.tween(this.portrait).to({alpha: 1}, 1, Phaser.Easing.Linear.None, false, 0).to({alpha: 0}, 1000, Phaser.Easing.Quintic.Out, false, 0); this.portrait.inTween.onComplete.add(function(){this.inFocus = true}, this.portrait); Problem: Using stop() also marks the tween for deletion and it won't play again. My ideas: - Using stop() and adding a new tween each time. As I see it, the downside would be that I need to add the onComplete function every time, too. Also, I'm not so sure about the memory usage for this one. - Overriding the stop() function to not remove the tween. I tried it bycommenting out this.manager.remove(this), but it's already causing some weird behaviour with the tween jumping to it's start randomly after completing, and I'm a little bit afraid that could cause other damage elsewhere anyways.. So... I'm very open to suggestions and/or clarification