Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by Puzz3l

  1. 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.updateS
  2. Looks like this (unfortunately) answers my question.
  3. 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?
  4. 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.
  5. 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;
  6. 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);
  7. 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?
  8. 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.
  9. 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); e
  10. So it looks like there is no way to check overlap in P2, other than with rectangles? That's very disappointing
  11. Is there an analogue to Arcade physic's overlap method in P2 physics? I only see collision-related methods in the doc.
  12. Is there any documentation about the format of JSON P2 physics data? I get most of it except the parts about filter and bitmasks.
  13. 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.
  14. 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.
  15. No responses, but I figured I'd just say I haven't been using a shutdown and it works fine so I'll go without one.
  16. Is it necessary to create a shutdown method like so to free up memory or is dealt with automatically? shutdown: function() { this.space.onDown.dispose(); this.arrow.destroy(); this.bombs.destroy(); this.blasts.destroy(); this.waves.destroy(); this.explosions(); this.enemies.destroy(); this.spawnAnim.destroy(); this.waveCharge.destroy(); this.label_score.destroy(); this.label_highscore.destroy(); this.game.time.events.remove(this.enemySpawnTimer);}
  17. Cool. I have a new problem though... Here's my code now: this.space.onDown.add(function() { if(!game.paused) { console.log('Here.'); this.g = this.game.add.graphics(208, 126); this.g.beginFill(0xffffff, 64); this.g.drawRect(new Phaser.Rectangle(0, 0, 720, 388)); this.g.endFill(); game.paused = true; } else { this.g.destroy(); game.paused = false; }}, this);Unfortunately the graphics is never drawn Wait a second I messed up, I see what I did wrong. I should be drawRect(new Phaser.Rectangle(0, 0, 720, 388))
  18. Wow now velocityFromAngle() is being glitchy Still, I prefer that to no pause.
  19. Just downloaded the dev branch, it works fine now I'm still curious why it doesn't work with the stable, though. I haven't used the dev branch before (hell, I never used Phaser before two days ago), are there anythings that won't work in it?
  20. Ok thanks. So just looks like I'll have to re-implement some functions, like angleToPointer(), in p2?
  21. I have a listener on the space button the pause the game, like so: this.space = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);this.space.onDown.add(function() { game.paused = !game.paused;}, this);I press the spacebar once, it pauses the game. I press it again, it unpauses it. I press it AGAIN and it doesn't pause. Why is this happening? Also; if I replace the game.paused = !game.paused;with just console.log("Here.");I get a log at every press, like desired. So it has something to do with the pause mid-execution of the listener. Not sure what the fix for that is, though.
  22. Is it possible to have a non rectangular hit box? I found these docs (oddly not from Phaser.io but look identical) which have a setCircle() and setPolygon() method for the Phaser.Physics.Arcade.Body, but the official Phaser docs do not. I see that the Ninja and P2 physics classes have a body element with some methods that look promising, but the rest of my project uses Arcade and there are some vague statements in the docs that make me think that there are some unimplemented features in the library. Can you have mixed physics? Can I implement arcade methods in Ninja or P2 (e.g. moveToObject(),
  23. Thanks! Since I had to wait a day between posting this and getting it approved by a mod I just did what I should have done before and looked it up in the docs
  24. So I'm playing around with hitbox bounds, but I want to actually be able to see the hitbox in-game. Is there a way to do that?
  • Create New...