• Content Count

  • Joined

  • Last visited

About erikwittern

  • Rank

Contact Methods

  • Website URL

Profile Information

  • Gender
  1. I recently wrote a series of 6 articles about how I developed the game 'Gravity Quest' using Phaser. The series comprises the following parts: Introduction and technology choice Gameplay design and implementation Gameplay implementation: collision detection Visuals and sound Level design Distribution All articles are available through or through the first article at Three of the articles were already featured on Commented source code of the demos presented in the articles is available at
  2. I have created a game called "Gravity Quest" for iPhone using Phaser (2.0.5) and Cocoon.js. More information is available at: The game is about coordination and timing skills. The player is an astronaut lost in space, whose only chance to return to earth is to navigate from black hole to black hole. To do so, you can press anywhere on the screen to accelerate towards the nearest asteroid. You have to avoid different obstacles and even some enemies. I used the arcade physics engine in combination with my own collision detection to detect collisions between (rotated) rectangles (the player) and circles (asteroids, novae etc.), after finding that P2 was too expensive for iPhone 4 and 4s. Tell me what you think!
  3. Hi *, I am very excited about the new pauseUpdate function, which runs while game.paused = true. However, I am unsure how to use it. While it constantly runs once the game is paused, it does not allow to react to input on priorly defined sprites (i.e., pause menu elements that I defined before pausing the game). For example, checks for menuTextButton.input.isDown stop to work in pauseUpdate once the game is paused. So, how do I use pauseUpdate to react to user input, for example, to resume the game?
  4. I think I found my solution: I use the dragging functionality for my purpose (thanks, Heppell08, for hinting at this). So what I do is: I enable dragging with: obj.input.enableDrag();(Note: obj.input.draggable = true; does enable reacting to dragging as well, but produced errors in my case because some instantiations, e.g. of _dragPoint, are not performed - thus rather use enableDrag()). Then, I can check for it (on desktop and mobile) using: if(obj.input.isDragged){ // do something...}Fortunately, obj.input.isDragged is true even if the pointer is just pressed, no matter of whether actual dragging happens, making this approach suitable for my purpose. As I do not actually want to drag something around (just detect the pointer being pressed), I also prohibit horizontal and vertical dragging using: obj.input.setDragLock(false, false);
  5. I actually also tried a hack by defining pointer1 as the input of obj like so: obj.input = game.input.pointer1;Interestingly, this works fine. Until you want to change the state in the game - then, it tries to call input.destroy() on pointer1, which does not exist. Any other ideas?
  6. Hm, you mean obj.input.pointer1.isDown ? Because that does not work, because pointer1 is undefined on obj.input (FYI: obj.inputEnabled = true is set)...
  7. Hi there, I would like to react to the player holding down the input on a sprite (e.g., called obj, with inputEnabled = true). On a desktop, I can achieve this for the mouse using: if(obj.input.pointerDown()){ // do something...}On mobile, however, the code does not work - I believe I would have to use something like pointer1, but it seems only to be accessible for the game object, for example: game.input.pointer1.isDownIs there a way to activate/use pointer1 on sprites as well?
  8. Thanks for the advise! I actually went that way and created a corresponding accelerateToObject function that I now use with P2 physics. Here is my code, if anybody is interested (it is inspired by the same method in the arcade physics system): accelerateToObject: function (obj1, obj2, speed) { if (typeof speed === 'undefined') { speed = 60; } var angle = Math.atan2(obj2.y - obj1.y, obj2.x - obj1.x); obj1.body.force.x = Math.cos(angle) * speed; obj1.body.force.y = Math.sin(angle) * speed;}
  9. Sprite.overlap() works fine with the bodies from the two systems, but it does not consider that the ninja body is a circle - it treats it like a rectangle. Hm, this seems to be difficult...
  10. Thx for the hint! I am unsure, however, where / how to use this. There is Phaser.Circle.intersects, Phaser.Line.intersects, and Phaser.Rectangle.intersects. If obj1 is an arcade rectangle and obj2 is a ninja body, should I use Phaser.Circle.intersects(obj1, obj2)? And how could I react to an intersection?
  11. Hello there! I would like to use both, the arcade and the ninja physics system in a small project. I want to use arcade because of some nice functions like "accelerateToObject" and I want to use ninja because it allows for circular bodies. I want to be able to react to the collision of objects, one using the arcade (obj1) and the other using the ninja (obj2) physics system. Using game.physics.arcade.collide(obj1, obj2,...) does not work, because the ninja body does not have a "position" property, as far as I can tell -> I get a corresponding error. Using, obj2,...) does not throw an error, but does not react to collisions also. Is there a way for collision to work in this scenario? A related question: is there a way to render a ninja body? This seems only to work using debug for the arcade system...