Karma Octopus

  • Content count

  • Joined

  • Last visited

About Karma Octopus

  • Rank
    Advanced Member
  1. Karma Octopus

    Phaser3 Tilemap with Tiled Editor

    This is how I do tile layers in v3: // Grass var mapDataGrass = scene.cache.json.get('enviromentMap').layers[0].data; mapDataGrass.forEach(function (current, index, array) { mapDataGrass[index] = current - 1; }); tilemapGrass = scene.add.tilemap(mapDataGrass, 0, 0, tileWidth, tileHeight, mapWidth, mapHeight, 0, 'enviromentImg'); // Dirt var mapDataDirt = scene.cache.json.get('enviromentMap').layers[1].data; mapDataDirt.forEach(function (current, index, array) { mapDataDirt[index] = current - 1; }); tilemapDirt = scene.add.tilemap(mapDataDirt, 0, 0, tileWidth, tileHeight, mapWidth, mapHeight, 0, 'enviromentImg'); etc. I use the same tile image for all layers for performance reasons but in theory it should probably work to have different images for different layers, I haven't tested though so I don't know if that works. Just replace 'scene' with 'this' if that wasn't clear. (I reduce the index by one to make it the right one.) Let me know if you need more info to get it to work. Basically I think I'm just doing what you are doing but using dynamic tilemaps and shifting the indexing. But it does work fine for me.
  2. Karma Octopus

    [Phaser] Sky Kid Mini

    Very cool game. I love how it reminded me of games from my childhood. The enter button didn't work for me either.
  3. Karma Octopus

    stba.io - Strike Tactics spin-off

    Really cool game! But if you press space the game scrolls up and away and you have to re-enter the web-page to restore it.
  4. Karma Octopus

    Camera(s) in v3

    Actually forget what I said above. I turns out that once you change the scale of the camera things start to get messed up real fast. Few things behave as expected. I thought it would be easy to add a minimap camera but it seems it not quite so. Not right now anyways, I'm sure it'll get fixed. Or maybe I just suck at phaser.
  5. Karma Octopus

    The Phaser 3 Wishlist Thread :)

    I found 'body.pos' and 'body.vel' in Impact but I had to make my own get functions to actually get to them. I see now that maybe I didn't need to do that for 'body.vel' but I still don't think 'body.pos' is reachable. I believe adding this.pos = this.body.pos; to the constructor of ImpactBody.js will solve the access problem.
  6. Karma Octopus

    Camera(s) in v3

    var minimapCamera = this.cameras.add(512, 0, 512, 384); minimapCamera.zoom = 0.5; This creates a minimap camera at pos 512, 0 with a size of 512, 384. Then it sets the scale to be half that of your regular rendering. If your need to set other properties on the minimap camera you can do that just like how you set properties on your main camera. minimapCamera.setBounds(0, 0, mapWidth * tileWidth, mapHeight * tileHeight); minimapCamera.scrollX += 100; minimapCamera.x = 100; For example.
  7. Karma Octopus

    The Phaser 3 Wishlist Thread :)

    I added some Impact physics to my test and it works very well. Some things that I needed though were getters for body position & velocity. I couldn't find any in the current code but I'm sure you'll add that later, if I didn't just miss it. In the mean time I just added some own temp stuff. Another thing I see is that debug boxes for bodies often overlaps when moving even if the bodies themselves don't overlap. I'm not sure if it's a bug or not. It looks like you maybe get the position data before the body has been pushed back after the collision.
  8. Karma Octopus

    The Phaser 3 Wishlist Thread :)

    Thanks, changing filtering solved the outline problem! I think that tilemaps should default to nearest, just like how Tiled does it. That way you also don't get the outline issue I had. Also if you could add some constants like Texture.NEAREST and Texture.LINEAR that would be neat. Ex: t.setFilter(Texture.NEAREST), or something along those lines. Edit: I found Phaser.ScaleModes in the src.
  9. Karma Octopus

    How to set hitbox?

    This is the wrong forum for your question since it relates to Phaser version 2. Try asking here instead: http://www.html5gamedevs.com/forum/14-phaser/
  10. Karma Octopus

    The Phaser 3 Wishlist Thread :)

    I've added some tilemaps to my test and generally it works fine. But I'm getting some odd artifacts on transparent tiles. I suspects it's due to filtering issues. So I'm wondering if it is or will be possible to set the filter mode for a texture manually, at least in webgl mode? For example I would like to use Nearest neighbor filtering right now for all the images I have but in some games I would need to have some images use nearest and some use linear filtering for example. I have attached an image to explain the issue I have. The left side if from Tiled (properly rendered) and the right side from the v3 test. I use dynamic tilemaps but with static tilemaps the result is exactly the same. You can see the outline on the dirt and the rock. You also see that the texture is smoothed in phaser.
  11. Karma Octopus

    Spritesheet Animation feedback

    I think this could be the best solution. The -1 is hidden but still there, very neat. I was a bit worried that loop and repeat are so alike that people would mix them up and not be sure which one does what. So it's probably best to only have one property for repetitions.
  12. Karma Octopus

    Spritesheet Animation feedback

    If other popular tween libs use -1 it might be good to keep it. It's just a bit strange if you haven't used those libs before. I don't think it's a bad way to to it, I'm just used to -1 meaning 'unset'/'do not use'. Maybe keep repeat like it is now then and also add a 'loop' boolean that overrides repeat if set? That way the developer can choose which way feels most natural too them? Would be nice to know what other people think too.
  13. Karma Octopus

    Spritesheet Animation feedback

    Yay! The new generateFrameNumbers works great, does exactly what I need it to. About -1 for repeat. After reading what you wrote it now makes sense how it works. But I think that many people will still find it strange and not understand it by just looking at some example code that someone wrote, just like what happened to me. This could be especially so for newer coders. I think it might be bit hard to grasp why it should be -1 without reading your text. I think it might be improved upon if the 'infinite repeat' is split apart from repeat. Like this: repeat: 0 - max repeats | choose no repeat or a limited number or repeats repeatForever: true/false | choose if to repeat forever -1 would have to be removed? as an option from repeat so you don't get (which would be unclear behavior): var config = { key: 'walkDown', repeat: -1, repeatForever: false }; I don't think this would affect how repeat works, just make it a bit more clear when you see examples like these: var config = { key: 'walkDown', repeat: 4 }; var config = { key: 'walkDown', repeatForever: true // pretty obvious what it does without having to look it up or repeatForever: 1 }; var config = { key: 'walkDown', repeat: 0 };
  14. Karma Octopus

    Spritesheet Animation feedback

    First of all I'd like to say that Phaser 3 seems very nice, flexible and lightweight. I got it to work but I get two errors in the console when I create a new Phaser game (I use the newly released alpha version): Uncaught TypeError: Cannot read property 'createTexture' of null at new TextureSource (TextureSource.js:119) at new Texture (Texture.js:58) at TextureManager.create (TextureManager.js:252) at Image.image.onload (TextureManager.js:45) Edit: this is in Chrome. In FF the error is: TypeError: game.renderer is null TextureSource Texture create addBase64/image.onload This is the config: var config = { type: Phaser.WEBGL, width: 800, height: 600, backgroundColor: '#bfcc00', parent: 'content', scene: { preload: preload, create: create, update: update } }; It happens when this line is run: var game = new Phaser.Game(config); Though the errors doesn't seem to do anything. Now onto the animation part, I have two pieces of feedback. 1. I tried to create a simple animation from a spritesheet. It is a standard sheet with four walk animations, every animation has three frames which should be run like 0, 1, 2, 1 in a loop. My problem was that I cant find a way to make that happen. When I use generateFrameNumbers it runs frames 0, 1, 2, 0, 1, 2. Which is of course the intention. I use this code: var config = { key: 'walkDown', frames: this.anims.generateFrameNumbers('playerSheet', { start: 0, end: 2 }), frameRate: 8, repeat: -1 }; So what I would like to see is either a function so I can tell it to use frames [0, 1, 2, 1] or maybe an example on how to create some object that does that. I'm not so good at JS yet but I think that the frames property need such an object and that is what generateFrameNumbers return. Basically I just want to tell an animation what frames in a spritesheet to use, just like you can do in Phaser 2.x. Like this: this.player.animations.add('walkDown', [0, 1, 2, 1]); 2. To make the animation repeat I have to set repeat: -1. I found that to be very odd and unintuitive. I would have expected it to be 1 for repeat and 0 for non-repeat. Keep up the good work.
  15. Karma Octopus

    Problem with Arcade Physics on mobile

    I also had this problem on my Android device (since performance is so bad). What I finally found out was that if I decreased the gravity enough this didn't happen any more, so it could be a good idea to try lowering the gravity and see if that helps.