Cudabear

Members
  • Content count

    86
  • 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 https://photonstorm.github.io/phaser-ce/Phaser.World.html#randomX and https://photonstorm.github.io/phaser-ce/Phaser.World.html#randomY to get a random position in the world to spawn them in. as such: diamond.reset(game.world.randomX, game.world.randomY) 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 https://photonstorm.github.io/phaser-ce/Phaser.Key.html#justPressed. if(controls.attack.isDown){ player.body.velocity.x = 0; if(controls.attack.justPressed) { //only play the animation if the user just pressed the key player.animations.play('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){ player.animations.play('idle'); } else { //walking animations???? } } else { //if we're in the air, we're obviously jumping or whatever player.animations.play('jumping'); } }
  5. You can pass a group as the arcade physics overlap function. https://photonstorm.github.io/phaser-ce/Phaser.Physics.Arcade.html#overlap 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: https://www.phaser.io/examples/v2/sprites/overlap-without-physics 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: http://phaser.io/examples/v2/arcade-physics/custom-sprite-vs-group
  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: https://github.com/Cudabear/ldwrap/blob/master/src/state/LoadState.js 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

    https://photonstorm.github.io/phaser-ce/Phaser.Group.html#setAllChildren 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.