woubuc

Members
  • Content Count

    10
  • Joined

  • Last visited

Everything posted by woubuc

  1. Have you tried not encoding it (e.g. as a .wav file)? Of course in a production environment this would create a lot of additional overhead (unless your sounds are really short and limited) and it probably won't be viable, but it should theoretically move the waiting process to the loading screen as it's loading the audio file, in exchange for removing the decoding wait time (since if the audio is not encoded there's no decoding that needs to be done). So you could test with something like that to see if the audio plays right away when it's loaded. ...Just thinking outside the box here, no idea if this would be viable for your project.
  2. Thanks, a very interesting read. I hadn't really thought about the chunks concept, in my first tests I just loaded my map data at the start of the game (it's not that large a map and I didn't really consider alternatives yet). But this has definitely set me on the right track for what I want to achieve
  3. What does the null parameter in your function do? According to the docs, .load.spritesheet takes arguments key, url, frameWidth, frameHeight. Since you're loading through a custom function I'm assuming it's not related to this, but I thought I'd mention it. The parameters frameWidth and frameHeight define the height of one frame in your spritesheet, so setting them to 196x156 (the full size of your image) may not be what you want. Especially if the code then goes looking for 8 frames of the specified frame size in the sheet (as per your last parameter). The size of one frame in your sheet would be 98x39px from what I can tell. I've never encountered this error for myself, though. If this doesn't fix it, try to find out what's inside the [object Object] in the error, maybe that could tell you a bit more.
  4. You have to do manual collision checks, yes. How you do this will depend on how your world data is stored, if it is in your tilemap you can check the tile you're about to move to and see if there's anything on it that could cause a collision. Since your game is grid-based, there won't be many actual collisions, you just check if you're allowed to move to a new tile or not before moving the player. I myself handle my grid differently (I have an object with all tile data separate from the tilemap because it is dynamically loaded and there's more info on it than just the tile), so more samples of my code probably won't help you, but if you're not sure where to start take a look at the "tile properties" example (or the "blank tileset" example), it has some code on finding the tile by X and Y coordinates (it uses the mouse but just substitute player.x and player.y to find the tile you're currently on).
  5. I'm only a beginner with PhaserJS myself, so I'm not comfortable with recommending Phaser-specific methods, nor am I 'fluent' enough with the Phaser functions to look over your script, so I'm afraid I won't be able to actually help you with this. I just thought I'd offer some general Javascript debugging and optimising advice. Someone else here will probably be able to look over your code and comment on it.
  6. The android browser is one of the worst to develop for, they often lag behind any other browser. But still, it seems odd that a simple game like yours is causing much trouble. I did inspect your game using the Google Chrome inspector on my desktop pc, and I noticed that even on my very powerful desktop it doesn't seem like it's running as smoothly as it potentially could. Looks like there's quite a lot going on behind the scenes, you may have to optimise your game loops (update and render). Use a Javascript inspector like in the Google Chrome dev tools to find the chokepoints in your game, do some benchmarking inside your app (log time differences between various actions to see how long it takes) and see if you can optimise any code. Some Javascript functions or methods are quite cpu-heavy and often those can be replaced by different structures. And in general, wherever possible, avoid loops (for, while) and remove variables when you're done with them to clear memory (especially if they're declared globally). These are some general tips for debugging Javascript code, hope it helps.
  7. woubuc

    roundedRect as mask

    Have you tried creating a separate object as new Phaser.Graphics, running the drawRoundedRect method on that, and then after that adding it to the game or the group or whatever you need to add it to? Just thinking here, I might be completely off (still pretty new to Phaser myself), but doing something like this has fixed a similar problem for me earlier today. Maybe it helps you too.
  8. I advise you to download the examples from gitHub, there are a lot of files in there but it's incredibly helpful to be able to see all the example code. It's not exactly a tutorial as such, but just by exploring the code in the examples you can already learn a lot.
  9. I'm working on something similar. Here's how I do it, I added comments to explain what's going on. playerMoving = yes // Check playerMoving at the start of your movement code, only do movement if it is false. If playerMoving is true, it means the player is still moving to his next square.var move = game.add.tween(player) // Create a movement tweenmove.to({x: newX * 32, y: newY * 32}, 180) // Move to the new grid position over a specific duration - this can be set to whatever you like, onComplete will only call when the animation is donemove.onComplete.add(function() { playerMoving = no // Set playerMoving back to false so that the next movement can start.}, this)move.start() // Now actually run the tweenSo basically I use a boolean to see whether the player is moving or not, to only move the player when he's not already moving. Hope this helps you
  10. Hi all, I'm new to HTML5 development and game development in general, but I do have a lot of experience with software and web development. Over the past weeks I tried out several frameworks for the game I want to make, and eventually settled on Phaser inside a nw.js window (because Javascript is my favourite language). I made some simple things to learn a bit about Phaser, and today I decided to start working on my real game (a space exploration and crafting game with a classic open world rpg feel - nothing huge, just wanna have fun making it and learning new things). So far in my game I have a 256x256 tilemap which is loaded from a server (dynamic, no preset map), I have a player that can walk around on a grid, and I have a camera following the player. Basic stuff. Now, when my player walks up to the edge of the tilemap, the camera stops following (because it hits the edge of the map) and the player wanders off the screen. Now I was wondering if it was possible to have the world "wrap around" instead of stopping the player at the edge of the map, so that the player could walk off the right edge of the map and end up on the left edge, or walk up off the top of the map and end up on the bottom, with the camera seamlessly following as if the tilemap just continues. Similar to the map in Civilization 5, where you can go around the world either way you like and it just goes on, except my map is just square and not round (or whatever Civ's map is). Is there a way to easily accomplish this using Phaser functionality? I was thinking maybe a way so that the camera could show a part of the view from the other side of the map (maybe using a second camera)? I checked the docs but couldn't find something that would allow for this, and Google didn't have a useful answer either. I could also just duplicate the tilemap when the player gets near the edge, and remove the original one when the player is far enough away from the edge, but I'm worried that this may introduce some memory issues (since the map is quite large and may possibly get even larger). So if anyone has tried / achieved something like this, or has some idea in which direction I could look, I'd really appreciate to hear your thoughts If you need more information before recommending something, feel free to ask.