• Content count

  • Joined

  • Last visited

About Cudabear

  • Rank
    Advanced Member

Recent Profile Visitors

822 profile views
  1. Phaser Collisions

    Hard to tell without seeing the rest of code. What you've posted seems like it should be working. Have you enabled arcade physics on PlayerHitbox, Player, and Enemy1BGroup?
  2. Phaser Combobox

    Looks like you'll be on your own for this one. You could build it using some logic and well-positioned sprites, but that would take a lot of work. Since you have full access to the DOM anyway, you may just want to float a select over your canvas at the correct position, and then use CSS to style it as close as possible to match your game. It should save you a lot of time in the long run.
  3. Need help spawning falling items in random position html5

    So your line: diamond.reset(350, 350) sets the diamonds to spawn at that exact position in the world each time you make a new one (x350, y350) You can use and to get a random position in the world to spawn them in. as such: diamond.reset(, This may spawn the diamond inside the tilemap, so you may want to work around that somehow.
  4. Phaser Key presses and animations

    For the first one, you're calling it every time through the update loop. You can use justPressed to prevent this if(controls.attack.isDown){ player.body.velocity.x = 0; if(controls.attack.justPressed) { //only play the animation if the user just pressed the key'attack', 7, false); } } For the second one, your idle animation is getting played every time your player sprite doesn't have x velocity. Since the jump is called whenever the user is jumping, I'd do something like this: if(!controls.attack.isDown){ if(player.body.touching.down){ //if we're on the ground, handle ground animations if(player.body.velocity.x === 0){'idle'); } else { //walking animations???? } } else { //if we're in the air, we're obviously jumping or whatever'jumping'); } }
  5. You can pass a group as the arcade physics overlap function. That said, you need arcade physics on all sprites within the group as well as the sprite you want to check against the group. If you feel you don't need physics on the group's sprites, check this example: Also, for future reference, you can forEach any group do custom work on each of its elements independently, just like a vanilla javascript array.
  6. Why does Phaser change image color pallete?

    I don't believe Phaser does anything other than importing the tileset image. It might be a browser specific issue with the way you exported your tileset. I'd play around with different browsers and image file formats to see if you can fix it. That said, I've never seen this issue with png tileset images in chrome.
  7. Switching x positions of two sprites

    You could probably set the character sprite to be a child of the ball, with the appropriate offset of the default state (let's say moving to the left). Then, when the player moves to the other state (the right) flip the x scale of the character sprite, from 1 to -1. The character should now be facing the opposite direction on the other side of the ball.
  8. body touching callback?

    I'm pretty sure body.touching never cares to check to see what it's touching. In order to do this, you'll probably want to add all the sprites that you want to affect by touching to a group, then call game.physics.arcade.collide(sprite, group, function(sprite, collidedSpriteFromGroup) { //affect collidedSpriteFromGroup here }); inside your update loop. This example uses overlap instead of collide, but it's effectively the same thing:
  9. My player will not move

    Tip: use non-minified Phaser for dev to get more descriptive errors. Looks like your animations are failing to play. Have a look at player.animations.add('left', [0, 1, 2, 3], 10, true); player.animations.add('right', [5, 6, 7, 8], 10, true); And see if those indexes are configured correctly (you have enough frames in the image, and so forth.
  10. Can I show the load progress of sprite Atlas?

    As far as I know, this isn't really feasible because there's no way to know how big the file being downloaded is. It's possible to get the `header` information from the request to get the total number of bytes downloaded already, and then compare that to some hard-coded value about the size of the value (or fetch the size of the file via some back-end request) but that seems fragile and too heavy-handed. Most Phaser games show progress as a percent of total files downloaded (not great if you've got a big sprite atlas, or large music files, but it's something at least) Here's my example of how I show progress of loaded files: The important line is `this.load.setPreloadSprite`.
  11. Water wave with Phaser

    I linked the github in the post. It was made for a gamejam so it's all open source. Feel free to take, use, and refactor anything.
  12. Euhm scaling a weapon/bullets It lists an example under the documentation here.
  13. Ludum Dare

    Thanks matt!
  14. Ludum Dare

    Awesome! Good work on your game too It would be a shame for you not to post it just because you missed the Compo deadline!
  15. Ludum Dare

    @MikeW You can still submit for the Jam, for about 8 more hours.