Puzz3l

Members
  • Content Count

    25
  • Joined

  • Last visited

  1. Puzz3l

    Issues With Appcache

    Bump
  2. Puzz3l

    Issues With Appcache

    Currently I'm trying to make an iOS web app version of my game. Unfortunately, when I added caching of files and try to load the app, I get this error: [Error] SyntaxError: DOM Exception 12: An invalid or illegal string was specified. fileComplete (phaser.js, line 43974) onload (phaser.js, line 43677) I tried looking it up the error, but it is fairly generic. The area of the phaser code it comes from is if (file.autoDecode) { var that = this; var key = file.key; this.game.cache.updateSound(key, 'isDecoding', true); this.game.sound.context.decodeAudioData(file.data, function (buffer) { if (buffer) { that.game.cache.decodedSound(key, buffer); that.game.sound.onSoundDecode.dispatch(key, that.game.cache.getSound(key)); } }); }Suggesting it might be some issue with appcache and music? Any ideas?
  3. Puzz3l

    Forcing Landscape Mode Through CSS Rotation

    Looks like this (unfortunately) answers my question.
  4. I want to have my game only playable in landscape, so I added the following code to my game.js // Autorotate screen function reorient(e) { var portrait = (window.orientation % 180 == 0); document.getElementById('game_div').style["-webkit-transform"] = portrait ? "rotate(90deg) translate(248px, 248px)" : ""; } window.onorientationchange = reorient; window.setTimeout(reorient, 0);Unfortunately, now if I try and use buttons/controls while holding the phone portrait, things get wonky. Buttons don't press and the input is clearly being messed with. How do I resolve this?
  5. Puzz3l

    Force sprite to rotate with P2 physics body

    Thanks! This works great. The only part I don't totally get is if (deltaMouseRad != deltaMouseRad % (mod/2) ) { deltaMouseRad = (deltaMouseRad < 0) ? deltaMouseRad + mod : deltaMouseRad - mod;}It seems like this further acts to limit the range of deltaMouseRad to [-Math.PI, Math.PI], correct? This keeps it from jumping as there is no need to turn 270 counterclockwise if you can just turn 90 clockwise.
  6. Puzz3l

    Force sprite to rotate with P2 physics body

    There is no sprite.body.rotate.rotateRight() method, but there is a sprite.body.rotateRight(). Unfortunately it's giving worse results than before... Trying to figure out why atm. EDIT: I also don't understand why setting rotation directly is so bad; I'm not too concerned about complete accuracy of collisions, I just need the hitboxes to work and the sprite to line up with the body. Why doesn't this work? this.arrow.body.rotation = game.physics.arcade.angleToPointer(this.arrow);this.arrow.angle = (180/Math.PI) * this.arrow.body.rotation;
  7. Puzz3l

    Force sprite to rotate with P2 physics body

    It only seems to happen when I run into world bounds; it that useful? EDIT: The specific code I use, could it be because I'm using an arcade function of a P2 body? this.arrow.body.rotation = game.physics.arcade.angleToPointer(this.arrow);
  8. I have a sprite and a body that both rotate towards the pointer. On collision, though, the sprite sometimes gets turned away from the body. The body continues to point towards the mouse but the sprite does not (see image, definitely not the worst that it can be). I haven't found a way to fix this, anyone know how?
  9. Puzz3l

    Updating P2 body radius

    Thanks George, I saw that but it doesn't apply. The size is limited to 100px so it shouldn't be covering the whole physics world.
  10. Puzz3l

    Updating P2 body radius

    So I have a group of sprites: var frameNames = Phaser.Animation.generateFrameNames('explosion', 1, 12);this.explosions = game.add.group();this.explosions.enableBody = true;this.explosions.physicsBodyType = Phaser.Physics.P2JS;for(var i = 0; i < 6; i++) { var exp = this.explosions.create(0, 0, 'explosionAnim', 'explosion1', false); exp.lastFrameName = 'explosion1'; exp.anchor.setTo(0.5,0.5); game.physics.p2.enable(exp); exp.body.clearShapes(); exp.body.setCircle(10); exp.body.setCollisionGroup(this.explosionCollisionGroup); exp.body.collides(this.enemyCollisionGroup, this.killEnemy, this); exp.body.collideWorldBounds = false; // Makes immoveable exp.body.mass = game.physics.p2.walls.bottom.mass; exp.body.debug = true; exp.animations.add('explosionAnim', frameNames);}And every step of their animation I want their body radius to change, so I do this in my update loop: this.explosions.forEachAlive(function(e) { e.damage(0.01); e.body.debugBody.draw(); if(e.frameName != e.lastFrameName) { var num = parseInt(e.frameName.slice(9)) * 8 + 10; e.body.setCircle(num); e.lastFrameName = e.frameName; }}, this);Now though, nothing collides with them. Anyone know why this isn't working?
  11. Puzz3l

    P2 overlap instead of collision

    So it looks like there is no way to check overlap in P2, other than with rectangles? That's very disappointing
  12. Puzz3l

    P2 overlap instead of collision

    Is there an analogue to Arcade physic's overlap method in P2 physics? I only see collision-related methods in the doc.
  13. Is there any documentation about the format of JSON P2 physics data? I get most of it except the parts about filter and bitmasks.
  14. Puzz3l

    Weird bug that appears sporadically

    Good idea, I might try that. I also realized I no longer need to use the dev build for my game to work as I resolved the issue that forced me to use it, and I haven't seen the bug since.
  15. So sometimes when I pause my game (not with game.paused, an overlay) or when I die and go to a game over overlay, I get this bug: Uncaught TypeError: Cannot read property 'length' of undefined phaser.min.dev.js:6b.Signal.dispatch phaser.min.dev.js:6dispatch phaser.min.dev.js:6b.InputHandler._pointerOutHandler phaser.min.dev.js:9b.Pointer.move phaser.min.dev.js:8b.Mouse.onMouseMove phaser.min.dev.js:8_onMouseMove phaser.min.dev.js:8Reload and do the same thing and it doesn't occur. Not sure what to do since the trace doesn't point to anything in my script. NOTE: I am using the dev build.