• Content count

  • Joined

  • Last visited

About Cudabear

  • Rank
    Advanced Member

Recent Profile Visitors

761 profile views
  1. 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.
  2. 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.
  3. 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.
  4. 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:
  5. 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.
  6. 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`.
  7. 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.
  8. Euhm scaling a weapon/bullets It lists an example under the documentation here.
  9. Ludum Dare

    Thanks matt!
  10. 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!
  11. Ludum Dare

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

    Yeah! We managed to get just about everything we wanted to get into our game: It's mostly content heavy, involved a lot of scripting and building systems to allow for scripting, and was an interesting experience. We created 10 unique rooms, 3 unique enemy types, a mini boss, a boss (sort of), and 2 endings. It should take less than 10 minutes to beat. You can find the source here as well:
  13. angular

    I'd assume it would be fine, provided there's no naming conflicts. Depending what you want to do, you could probably just instantiate a phaser game object inside a controller or directive. If you need this to persist beyond the scope of that controller/directive, maybe you could potentially put it in a service. You could even put it in a RunBlock, and it would be fine. I guess it all depends on what you're trying to do with Angular on top of Phaser.
  14. checking positions

    Here's a good way to do it using two rectangles: You could just use the bounds of the sprite instead of one of the rectangles, then check if intersects exists and has height/width to determine if a part of the sprite is within the target rectangle. Furthermore, you could check to see if intersects has the same bounds as your sprite if you want to see if the sprite is all the way inside the rectangle.
  15. How to organise game worlds?

    What I typically do is have a game state that corresponds to your main gameplay loop, IE when your user is actually playing the game. Then, I feed this gameplay state a data object that represents the level that the player will be playing on, with information such as where the character spawns, where the goal object(s) spawn, where enemies spawn, gameplay triggers, ect. The main loop can parse out this data and actually calculate the logic on the fly. This way, you create degrees of separation between your gameplay logic and the data that represents your "worlds" and it'll be much easier to add more worlds or change mechanics later. Then, when it comes time to switch to a new world, you just have to restart the state again with a new "world" data object.