Jump to content


  • Content Count

  • Joined

  • Last visited

  1. Ok thanks again, I was hoping there was an easy solution. I think I can manage to do it with the method I mentioned,but it's very hard to get it right. It would help if there was something like a 'bounced' or 'blocked' property (or event), to check which sprite is blocking the other sprite. At this moment I'm using a collision-handler to find the block that the playersprite bumped into, but it's a bit tricky because the block that the player stands on is sometimes also colliding (especially when it's moving up and down). And sometimes there's no collision at all, because the velocity was
  2. I have a game with a player sprite that moves on top of platforms (like Mario). Right now it works with Arcade physics for the y-axis and tweens for the x values, so I can control the horizontal movements very precisely. All moves of the playersprite end on a 64x64 grid. So when a tween ends, the x value is always a multiple of 64. Now I want to implment the physics engine for the x-axis as well, but I'm having trouble to achieve the same grid-value thing as above. When the playersprite bounces into walls, i want it to move to the nearest 64x64 position (but looking natural, of course). I
  3. I'm trying out the P2 physics engine, but I'm thinking I only need physics enabled for the y-axis. For example, a car-sprite that moves from left to right on a bumpy road. I would like the car to bounce up and down, when there's a bump in the road, but it needs to maintain a constant horizontal movement, and no weird collisions that make the car move left or or extra to the right. Is this possible with P2, or should I use Arcade physics (or maybe no physics engine after all) ?
  4. I'm experimenting with P2 physics. I have a game where there are several platforms directly next to each other, with no pixels between them. When I enable P2 physics on these platforms they start bouncing like crazy, as if they're pushing each other out of the way. Already tried applying materials and changing the friction, restitution, kinematic properties but I couldn't solve this. Any way to avoid this from happening?
  5. I'm trying to understand how Phaser tilemaps work (with a map size much larger than the screen). When the camera moves, are the tiles that were off-screen painted instantly or were they already painted on a big bitmap (as large as the whole map), which is simply moved when the camera moves? If it's the second option, wouldn't this become very slow with a map of 10000x10000 tiles ?
  6. Hi, just wanted to know if there's already built-in support for creating a sprite that is made up from different tiles. I know TileSprite is used to give a sprite a texture, but that's not what I mean. I also don't mean a sprite from a spritesheet, for animations. I mean a sprite of let's say 128x128 pixels that is made from 4x4 tiles of 32x32 pixels. I'm now struggling to do this myself, by using a bitmapData object and copying tiles, but was just wondering if maybe I'm re-inventing the wheel here.
  7. I'm trying to extend Phaser.Sprite to my own sprite class, to add some extra features. I don't like the prototype way of extending objects, so I implemented my own extend-method (similar to John Resig's Simple Javascript inheritance). I want to create a sprite, using an object that defines its properties (such as color, width, height, texture, etc.) To do this, I want to create a bitmapData object inside a method of my new class. The problem is that methods only exist after creating a object. But the create function of Phaser.Sprite already expects the bitmapData to be ready! I found a wo
  8. I'd like to be able to do the following : var playersprite = Phaser.Sprite.create(game);playersprite.x = 100;playersprite.y = 100;playersprite.key = 'dude';instead of var playersprite = Phaser.Sprite.create(game, 100, 100, 'dude');So is there a way to just create the sprite first, and then afterwards assign its properties ? (The reason for wanting this is a bit complex, but has to do with extending Phaser.Sprite to a different class)
  9. Tried again on Chrome (after restarting my computer) and it works now. Don't know what was wrong... 20-40% CPU seems quite a lot, so maybe playing mods in the background of actual gameplay would not be such a good idea... Quite amazing that an Amiga 500 played these mods 25 years ago without any problems on a single-core cpu that's 1000x slower than my computer now... Thanks for the sources, I'd already hacked your examples to try it out in my game
  10. Very impressive, jwothke! Can't get them working on Chrome (37) though, but in Firefox it works great. Is there a difference between the versions in terms of CPU-usage ? And would the amount of samples and number of simlutaneously played samples in the mod make a big difference in CPU usage?
  11. When I create a repeating tween that yoyos with : var tween = game.add.tween(sprite).to({y: sprite.y+100}, 1000, Phaser.Easing.Linear.None, true, 0, 9999, true);it restarts beautifully when I leave the browser and return. But when I create a chained tween that loops, like : var tween = game.add.tween(sprite).to({y: sprite.y+100}, 1000, Phaser.Easing.Linear.None, true, 0, 0, false);tween.to({y: sprite.y}, move.time, Phaser.Easing.Linear.None, true, 0, 0, false);tween.loop();then the tween is stopped and doesn't always restart when I return to the browser (but sometimes it does, after a while!).
  12. Thank you lewster32 , the following does work : blocksprite.body.moves = false;The player now stays on top of the blocks, whatever movement is done to the block underneath. However I get the feeling from you guys that I'm doing something that gets me in trouble some day. The reason I want to use tweens for the block movements, is because I need easing, which I find very hard to do with changing the velocity of the blocks only. Any way to get a nice easing (bounce) effect on those blocks without using a tween?
  13. I have a game where a player-sprite can jump on top of blocks. These blocks are moving vertically up and down (with a tween). Arcade physics and gravity is enabled on the player-sprite only. But sometimes the player-sprite falls 'through' a block, as if the physics engine of the player can not calculate correctly if there's a block underneath the player. Can anybody tell me why this is happening, and how to prevent this ?
  14. In my web-applications I use jQuery a lot, for example $.each() to iterate over arrays, etc. I would like to use these in a Phaser game as well. I could also use jQuery Mobile which is a bit lighter. Is this a good idea, or is this very likely to slow my game down? (Of course I understand I cannot use the DOM-selectors that jQuery is famous for).
  15. Somehow the event is fired multiple times, when I have multiple load's in the preload. I'm using different gamestates now, which is the supposed way to load assets in multiple stages.
  • Create New...