• Content Count

  • Joined

  • Last visited

About Zekko

  • Rank

Recent Profile Visitors

393 profile views
  1. Zekko

    Camera gets stuck on window resize

    Ah, calling world.setBounds(x, y, width, height) after calling world.resize(width, height) makes it work properly! Thank you! Strangely, calling world.setBounds() by itself makes the camera start at y=0 (and stay stuck there). According to the Phaser docs, world.setBounds() updates both the position and size of the world as well as the camera bounds. I'm having a hard time understanding why I need to call both functions to make the camera do what I want it to do (I also needed to write my own camera bounding function, since the bounds I set don't seem to be respected anymore), but that's probably just me being stupid. Oh well, if it ain't broken don't fix it, right?
  2. Hi guys, I'm having an issue with Phaser.ScaleManager.RESIZE set. As expected, it resizes the game to the size of the window. However, whenever the window is resized, camera.y gets set to 0 and doesn't respond anymore. Even setting camera.y directly in the update function doesn't do anything. Interestingly, camera.x doesn't seem to be affected. Restarting the game state fixes it, but that doesn't solve that fact that I'm now unable to move the camera after resizing the window. A similar issue seems to be reported in this post, but there was never a reply. Does anyone have any ideas what could be the problem? Any and all help will be much appreciated! Cheers, Zekko
  3. Zekko

    WHY are particle emitters so hard on performance?

    I'm experiencing the same issue: my fps drops from 60+ to about 30 with three particle emitter pumping particles at a frequency of 200 (default is 250). I'm testing on a Windows Phone, re-building and deploying through Visual Studio every time, so the cache can't be the issue. Bunnymark also runs at a solid 60 fps on my phone with up to 5000 bunnies on screen so drawing is not the issue. I suppose you could tween individual sprites, but then you're basically writing your own particle emitter function and that's just silly. I'd really appreciate a comment from Rich on this!
  4. Zekko

    How to disable group incrementing my z values?

    A z-depth value refers to the displayObject's z-value within it's group. In the example, all the clouds created within the cloudLayer group each have their own z-depth values, so the game knows the order in which the clouds should be drawn. However, all clouds belong tot the cloudLayer group, which has its own z-depth value. Since the cloudLayer group has a z-value of 1, while the groundLayer has a z-value of 2, the cloudLayer (and all the clouds it contains) will be drawn before the groundLayer. So the draw order is this (top to bottom): cloudLayer group (z = 1) - cloud sprite (z = 1) - cloud sprite (z = 2) - cloud sprite (z = 3) groundLayer group (z = 2) - ground sprite (z = 1) The updateZ() method is actually required, because two objects within the same group cannot have the same z-depth value (the game wouldn't know which one to put in front).
  5. I'm trying to figure out how to best detect overlap between a tileSprite that's resizing and relocating every frame (I use it to visualize a physics spring) and a group of sprites with circular P2 bodies attached (in order to remove the spring upon contact). I tried attaching a P2 body to the tileSprite (spring) and call body.setRectangleFromSprite() every frame like so: spring.body.x = x;spring.body.y = y;spring.width = width;spring.body.angle = angle;spring.body.setRectangleFromSprite();...and was planning to enable the body's data.shapes[0].sensor for overlap detection as described here: http://www.html5gamedevs.com/topic/5567-trigger-with-p2/ However, for some reason the body's angle is different from the sprite's angle (see attached images) (I'm ignoring the body's offset for now). The body appears close to perpendicular to the sprite when the sprite is almost vertical, while the body almost matches the angle when the sprite is close to horizontal. Math has always been my Achilles' heel, but this smells like a sine/cosine problem to me. Am I doing something wrong? Or is there an altogether better way of going about this? Many thanks in advance to this wonderful community!
  6. Ah, it's in the world class! I'll try it as soon as I get home. UPDATE: Works like a charm, thanks!
  7. Hi all, long time lurker, love the framework! The fact that I've done two weeks of coding without having to ask a question really shows the quality of Phaser, the docs, and the wealth of information on the forums! Unfortunately, I couldn't find an answer to this. I'm trying to get a local point on a P2JS body converted to world co-ordinates. To put it into context: I want another sprite to move to a specific point on a physics body. Funny enough, there are parameters in the physics.p2.createSpring() that allow you to specify local points on the bodies to attach the spring to. Similar parameters are found in the P2JS constraint cosntructors. However, looking at the source code taught me nothing because it's just a reference to the P2JS spring creator. I looked in the P2JS docs to find a LinearSpring.getWorldAnchorA() function, but calling it as spring.data.getWorldAnchorA() results in the following error: Uncaught TypeError: Cannot set property '0' of undefined Phaser.js:79022 I suppose I could put the body in a group along with an invisible sprite to mark the local point and get sprite.world, but that feels so hacky. I'd create an empty group to mark the point, but groups don't have a world attribute. I could found no function in the Phaser docs to convert a local point to a world point, which seems such a simple and common thing to do. Am I missing something?