ncil

Members
  • Content count

    33
  • Joined

  • Last visited

About ncil

  • Rank
    Advanced Member

Contact Methods

  • Twitter
    nickcil

Recent Profile Visitors

83 profile views
  1. You're welcome! Good luck and keep it up!
  2. You need to give them a negative x velocity for them to move towards the left. So try game.rnd.between(-100, -300); Additionally this function that checks the enemy position should be reversed since you are switching the sides... if the x position is < -100, set enemy.x = 800. I think that should do it.
  3. Hi, could you post some of your code so we can take a look?
  4. Not sure about an add-on, but the tutorials here should help you: http://www.emanueleferonato.com/tag/hexagonal-tiles/
  5. Hello! Have you read through this short book? It covers the Scale Manager and basic implementation for responsive games. https://leanpub.com/phaserscalemanager
  6. In general, I think it's easier to keep the player static and move the objects around for scrolling games like the one you're describing. If you wanted to move the player and have the camera follow, you could probably implement your own camera behavior by setting the game.camera.y position in the update function. You would offset that position from the player.y position by however much you wanted. Thus you could have the camera follow the player but not have the player in the middle.
  7. Hi David, I recently came across this and you might find it helpful to read through: https://leanpub.com/phaserscalemanager
  8. Glad you got it working! So the problem was just layer.scale and maybe Edge?
  9. Oh, bummer. Are you getting any console errors?
  10. I have no experience with tilemaps but I took a minute to look through your code and have a suggestion... map.setCollision(9, true); For that first argument it's expecting a number or an array, you're giving it an array with one value. Did you try just doing 9 instead of [9]? Again I'm not sure but it seems like 9 would mean "all tiles with an ID of 9" and [9] would mean "the 9th tile in the map". Give that a shot and let me know if it works... Reference: https://phaser.io/docs/2.4.4/Phaser.Tilemap.html#setCollision
  11. What happens when the player overlaps the coin? Any errors? This might be the problem: game.physics.arcade.overlap(coin, player, killcoin(), null, this); should be... game.physics.arcade.overlap(coin, player, killcoin, null, this); Try that
  12. I can't think of any way to do this that doesn't involve some sort of check outside of the onDragStart. This doesn't exactly answer your original question, but why not just remove the sprite when the pile is empty? It seems to me if there's none left in the pile, there shouldn't be anything there for the person to try and drag in the first place. When you drop a new one into the pile, just add the sprite back. To me that sounds like the simplest solution, but that is based on my limited knowledge of your game.
  13. Hi again—either I'm not understanding what you're trying to accomplish or you're misunderstanding collisions in Phaser. To my knowledge, you don't really "add" collisions at will during the game. They need to be set in the update function which is called by the main game loop. So you set your collision detections at the beginning and they will be checked as the game is played. Collisions cannot be generated at will. They have to occur when 2 objects collide/overlap. So, if you want to have an "invisible" collision, for example when a player reaches a certain spot on the map without appearing to run into anything, you could add a collision handler that checks for overlap of your player + an invisible sprite, and then do something. You could then create your own function that places invisible sprites at the x, y position you want to check for collisions. Again I'm not entirely sure what you are trying to accomplish with "generating invisible collisions" so you'll have to take my advice with a grain of salt. Here is a helpful tutorial for the basics of collisions in Phaser: https://www.joshmorony.com/phaser-fundamentals-handling-collisions/
  14. Your original code has been deleted/expired, so you might want to repost. Anyway, it seems like it's a problem with your sprite's body. Did you try debugging the body of the player/heart? render: function() { game.debug.body(SPRITE); } This will show a box around the body of your sprite so you can see what is colliding.
  15. What do you need to create a function for?