swissnetizen

Members
  • Content Count

    49
  • Joined

  • Last visited

About swissnetizen

  • Rank
    Advanced Member

Contact Methods

  • Twitter
    swissnetizen

Profile Information

  • Gender
    Male

Recent Profile Visitors

1,034 profile views
  1. swissnetizen

    Bug? Sprite falls through world if rotated

    I've found a work around; instead of setting the slope to -45 I set it to 2pi - 7×-0.7853981633974483 (≈-1.502212856217862) which mostly works, but can still be glitched out: http://g.recordit.co/juY6h6aUkT.gif Does anyone know why this works?
  2. (http://g.recordit.co/o5HlkT1d5S.gif) Hi, so my setup involves two hills, where the player is rotated to match the slope angle. The first hill rotates the player to an angle of -45° and the second rotates it to 45°. The problem is that once the second rotates the player, the player can just fall through the bodies. My code for the hills is almost identical. (have a different triangle and angle). I think this might be a bug in p2. Any thoughts? EDIT: I've added a second example: http://g.recordit.co/FLgBsRxbeI.gif In this example we can see that the sprites will slide down the first hill, but upon touching the second they will fall through the wold.
  3. swissnetizen

    P2 moving platform

    Hi! I've been trying to make a moving platform where the player (and other sprites) can ride upon. I tried using something similar to this example (http://jsfiddle.net/pandavigoureux29/zphsz7kp/) to no avail. I've also tried using a contact material and messed with the various friction properties to no avail. I've seen a gravity based solution that ramps up gravity 100x, but I can't use that because of how my game works. Thanks in advance for your help!
  4. swissnetizen

    How to check if on Floor using P2?

    For future reference, this is how to detect if the entity is on the floor (I think): var checkIfCanJump = function() { var c, d, i, result, yAxis; yAxis = p2.vec2.fromValues(0, 1); result = false; i = 0; while (i < game.physics.p2.world.narrowphase.contactEquations.length) { c = game.physics.p2.world.narrowphase.contactEquations[i]; if (c.bodyA === player.body.data || c.bodyB === player.body.data) { d = p2.vec2.dot(c.normalA, yAxis); if (c.bodyA === player.body.data) { d *= -1; } if (d > 0.5) { result = true; } } i++; } return result; }; from: http://phaser.io/examples/v2/p2-physics/tilemap-gravity
  5. swissnetizen

    How to check if on Floor using P2?

    I don't think you understood. I want to check if it's on a floor outside of an event handler. The example uses event handler with collision groups that's not what I want to do
  6. swissnetizen

    How to check if on Floor using P2?

    Hey, So I need to check whether a sprite is on the floor using P2 physics. Basically something like Arcade.onFloor() but for P2 physics.
  7. swissnetizen

    Text doesn't render properly after loading tilemap

    Thanks! that was it!
  8. swissnetizen

    Text doesn't render properly after loading tilemap

    That makes sense, how would you do that?
  9. swissnetizen

    Text doesn't render properly after loading tilemap

    Just updated to Phaser 2.4.6, no improvement.
  10. swissnetizen

    Text doesn't render properly after loading tilemap

    The issue is that it doesn't show; yet when you check game.world.children it says that the text exists.
  11. swissnetizen

    Text doesn't render properly after loading tilemap

    I do change states, but I think it's caused by the tilemap because I've checked diffs of the source before and after and tilemaps was the major change (there was a minor tweak to some keyboard events).
  12. This is on 2.4.4 because 2.4.5 has some text rendering issues of its own. I've got this really weird issue. I have a menu screen which advances to a level select and then play. When advanced to the level select then back to the menu, the menu text is unaffected. If I advance to a level before going back to the menu, the text doesn't appear any more (I've checked, and it does exist). But when we try to advance to a level which doesn't exist (and I deliver an error message) the text still appears. I've narrowed the issue down to when I added support for tilemaps.
  13. Hi, I want to use a P2 body to detect when a player has crossed a certain point.
  14. swissnetizen

    Detecting the collision side.

    There isn't anything in the Contact Equation array. The easiest way I have found is: // Returns direction in radians Math.atan2( sprite1.x-sprite2x, sprite1.y-sprite2y )
  15. swissnetizen

    Detecting the collision side.

    I need to detect the side on which my sprites collide, I'm using P2 physics. I think there should be something in the contact equation array.