fillmoreb

Members
  • Content Count

    71
  • Joined

  • Last visited

1 Follower

About fillmoreb

  • Rank
    Advanced Member

Recent Profile Visitors

1096 profile views
  1. Umz has got the right solution. Here's a fiddle I made a while back to answer a similar question. It should demonstrate how to accomplish what you want. Good luck. https://jsfiddle.net/mub2ps0c/7/
  2. @bali33 Sorry for the late response, I've been very busy at work lately, so haven't had the time to check in here at the forums. I'm not sure why you're having issues. If you're still having trouble, go ahead and post your full source and I can help you track down the problem. @noesgames Sorry to you for the even later response. I haven't needed to get a notification on a completed animation, so the plugin doesn't have any system to do that. Sorry.
  3. I would do something like this: var time_til_spawn = Math.random()*3000 + 2000; //Random time between 2 and 5 seconds. var last_spawn_time = game.time.time; update() { // This is your state's update loop var current_time = game.time.time; if(current_time - last_spawn_time > time_til_spawn){ time_til_spawn = Math.random()*3000 + 2000; last_spawn_time = current_time; spawnCustomer(); } }
  4. Hmmm... the code you're posting should only move a single sprite. I'm not sure why both of yours are moving. Can you post the rest of your code?
  5. It's possible. Post code demonstrating how you made the sprites go towards the pointer on click, and it'll be easier to give you advice on how.
  6. Phaser.Rectangle is not a DisplayObject, it's not really meant to be drawn onto the screen. You can use the debugger to visualize where a rectangle is like this: game.debug.geom(ground,'#0fffff'); But I don't suggest doing this for all of your game's visuals. Instead I would make a sprite for the ground, add a graphics object as a child of that sprite, and draw a rectangle onto that graphics object, something like this: var g = game.add.graphics(); var groundSprite = game.add.sprite(); groundSprite.addChild(g); g.beginFill(0xFF0000); //Red Fill Color g.drawRect(0,0,game.world.width, 50); groundSprite.y = game.world.height - 50; You can then recolor the rectangle at will by doing this: g.clear(); g.beginFill(0x0000FF); g.drawRect(0,0,game.world.width,50); You could also experiment with using groundSprite.tint to recolor your shapes.
  7. Phaser's physics doesn't support bitmasks as the collidable body. If you choose to use them, you would most likely have to ignore Phaser's physics and create your own physics engine. If you're more comfortable working within the system that Phaser has set up, you probably want to stick with polygons. Once you've got it figured out they'll work just fine for you. Just choose whichever method feels like the best fit for you. I prefer bitmasks, but that's probably because I'm an old-school programmer. Here's a link to a worms clone that was written for HTML5. It's not phaser, but it's using polygons. You can go and check the method they are using for terrain deformation to help you get going. https://github.com/CiaranMcCann/Worms-Armageddon-HTML5-Clone/blob/master/src/environment/Terrain.ts
  8. Check to see if the mouse is over the sprite and if it is, you can manually force the hand cursor by doing something like this: this.game.canvas.style.cursor = "pointer"; sprite._setHandCursor = true; I'm not totally sure on the second line, but you might need to include it so that the sprite knows it's using pointer and needs to turn it off on mouse out.
  9. The sprite's position never actually changes, which is why you don't get a change in the coordinates. If you want the apparent position of the planet use something like this: apparent_x = x + Math.cos(rotation)*orbit_radius*scale; apparent_y = y + Math.sin(rotation)*orbit_radius*scale; EDIT: Needing to multiply by scale depends on whether you want scale to affect the orbit radius or not. That's probably obvious, I just wanted to clarify.
  10. Well, you have a line in your code that says: game.debug.spriteInfo(sprite, 32, 32); However, you never define a variable called sprite. You probably meant to debug steve, right? Try replacing the sprite with steve: game.debug.spriteInfo(steve, 32, 32);
  11. To do this, I would probably walk around the edges of the visible pixels and create a point at the edge of each. This would create a very detailed polygon that perfectly matches the pixels. Then I would use Ramer–Douglas–Peucker algorithm to simplify the polygon. Honestly, though, I wouldn't do any of that. To do a Worms game, I probably wouldn't use polygons at all. I would probably represent the collidable parts of the level and sprites as simple bitmasks. You could then use bitwise operators to detect collisions and to cause terrain destruction.
  12. @Hadik, you may want to try Ninja Physics before you give up all together. It allows you to have circular physics bodies. That might be enough to make the balls bunch up the way you intend without bogging down the lower end machines.
  13. I would try using cache.removeTextureAtlas("MyShip"); right before you try loading the new file. Might work.
  14. I just looked through the code of Loader, and it looks like there are no provisions for doing what you want.
  15. This example, I feel, is exactly what you are trying to do: http://gamemechanicexplorer.com/#fluid-1