• Content Count

  • Joined

  • Last visited


About elleniaw

  • Rank

Recent Profile Visitors

803 profile views
  1. HYBRID MAGIC Gone Wrong! You had been warned by the Warlich Warlock Society and even the Wugonian Wizards not to fool around with hybrid magic. But ... that idea! That bright idea of combining ice and fire magic into an amazing Hybrid Magic. You couldn't resist it any longer. It lingered and pressed upon your curiosity like a million pounds of Galgonium dead matter - that horrible urgency for you - out of all wizards - to be the one to make this a reality. A bittersweet reality so it seems now. For the Hybrid Magic Gone Wrong! Today I released my game just in time for the Github Gamejam 2018. https://hobscure.itch.io/hybrid-magic There is a github project you can look at here: https://github.com/nahkranoth/FactorySimulator/tree/HybridFix
  2. Found the problem: Because I generate the tilemap myself I have to be sure that all tile indexes are set when running the map.setCollision. This also means that for every tile I would generate I would have to either run the set collision again - or manually set colliding to true.
  3. I think Samid just made this to show you how you would do it - like in half an hours work. Of course, it's not going to feel very natural, those things take a lot of time to fine tune.
  4. I tried adding the line and also seeing what it does this.layer.setCollisionByProperty´╗┐({ collides: true })´╗┐´╗┐ And saw that it's setting the collision to true on a tile that has (for instance) the property collides as true attached to it. I tried setting that property to true when creating the tiles: _generatePerlexMap(){ for(let y=0;y<this.mapHeight; y++){ for(let x=0;x<this.mapWidth; x++){ let tile = this.map.getTileAt(x, y); let i = this._getRandom(x, y); tile.index = i; tile.collides = true; } } } But .collides is readonly. I thought maybe I misunderstood and tried to set it as tile.properties.collides but no luck there either. (It does not make sense doing it like this to me but I wanted to try it anyway) I see the TileIndexCallback being called on a hit but I don't see any expected physics behavior. In the examples I see a lot of tile collision examples being broken. I'm not complaining but I don't think this is a very stable part of Phaser at the moment and might have to look into the inner workings of tile layer collision and arcade physics to see if the problem might arise from there. I still have some hope that somebody can point me to an obvious mistake. Something I misunderstand. Please look into the github project if you want the complete project.
  5. The map is not the graphical object. The layer is. (the result of createDynamicLayer or createStaticLayer) I'm not a hundred per cent sure the static or dynamic layer does have a alignTo method. If not you could try: https://photonstorm.github.io/phaser3-docs/Phaser.Display.Align.To.html Where you would call it as a static method: Phaser.Display.Align.To.BottomRight(tileLayer, this.cameras.main, etc I hope this helps. I haven't tried it out myself - but I do know that the tilemap is not a graphical object.
  6. As you can see in here: https://photonstorm.github.io/phaser3-docs/Phaser.Physics.Arcade.Factory.html#collider__anchor the method takes a callback, but also as a last parameter it takes a context. So instead of doing this: create(){ this.physics.add.collider( this.player, this.bombs, npcs.hitBomb, null, this ) Do this: create(){ this.physics.add.collider( this.player, this.bombs, npcs.hitBomb, null, npcs ) Because now you pass a context to the callback (npcs.hitBomb) the npc's context. If you ever run into a situation where a method would not give you the possibility to pass a context you can look into .bind: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Function/bind Lambdas are also a great way to work around it but I would not recommend that for how you want to use it (calling a method on another object)
  7. Thanks! I will take a look at your suggestions. Especially the first suggestion - althoug I don't see that's how the examples use the tile colliding - it might point me to the right direction. The weird part is that the tileIndexCallback does work - that function gets called without a problem. The problem is that the sprite doesn't stop moving when touching a tile. Like collision detection works, but it's effect on the body physics doesn't.
  8. I'm trying to make a physics sprite collide with a Dynamic TileMap but I cannot get it collide. There is a github with my code here: https://github.com/nahkranoth/FactorySimulator/tree/tilemap-creator I took this as an example: https://labs.phaser.io/edit.html?src=src\game objects\tilemap\collision\tile callbacks.js I setup the tilemap like this (in tileMap.js) note that tileset is a tileset I created by generating a texture out of a graphic but I don't think that should matter: this.layer = this.map.createDynamicLayer(0, tileset, 0, 0); this.layer.setCollision(1); Then in game.js I make a physics sprite and add it to the collider: this.sprite1 = this.physics.add.sprite(120, 420, "tiles"); this.tilemap.layer.setTileIndexCallback(1, this.hitCoin, this); this.physics.add.collider(this.sprite1, this.tilemap.layer); >> The callback hitCoin is called when the sprite is colliding with a tile, but the sprite wont stop on a tile. While I took this from earlier code and it did stop. I know this explanation is missing a lot of details that matter - but if you look at those two files in the github project you should be able to find out those details. edit: Does the fact that I set the index of the tiles like tile.index = 1? IS there another method I'm not aware of?
  9. Shaders can be super fun - but at first hard to wrap your head around because it requires a different way of thinking on how to control graphics through programming. There are plenty of shader tutorials online for webgl that can easily be applied to Phaser because they are one and the same thing. The only thing you have to figure out in Phaser is how to add a custom render pipeline to an object: https://labs.phaser.io/view.html?src=src\renderer\Custom Pipeline.js A good point to start with shaders is: https://thebookofshaders.com/ And a good prototyping editor would either just be Phaser or shadertoy.com
  10. @PixelPicoSean Not really what I meant. In Tiled (tile editor) you can flip and rotate individual tiles. When I now import that into Phaser 3 the rotation and flipping of those tiles is not applied. Don't spend any time figuring this out though. I can read the code myself and find out what's wrong.
  11. elleniaw

    Load tilemap

    It's either this.map.createDynamicLayer or this.map.createStaticLayer. It depends on if you want to replace/add tiles while active; just go for createStaticLayer for now.
  12. I have this same question. In the end I merged my tilesets and redid the level in Tiled. Another question is if rotated/mirrored tiles are supported?
  13. Internally there is a huge difference between Phaser 2 and Phaser 3. In using it there are also some differences - but they don't follow completely different paradigms. Only you can really answer this question, but I can however point you to some things to consider. Phaser 3 is very new and not a lot of examples are present - and those that are, are pretty well hidden. The documentation is not ready yet, etc. This makes it pretty difficult to work with if you have some experience with Phaser 2 - and very hard if you have never used a game engine before. You can work partially around it by looking into the source of Phaser 3 yourself and figuring things out through that - but some things are pretty hard to find that way. When will this be easier? I cannot promise anything - but I do think that within a year there are many more examples available and many questions asked and answered. Many bugs will be found and removed, etc. Soo, it's really up to you if you want to dive into the Phaser code, struggle with finding the right ways of doing stuff, etc - or you just want to make a game the most easiest way. For the latter choose Phaser 2.0.
  14. elleniaw

    Particle system

    You can do anything that you can do with hardware acceleration without hardware acceleration. It will just run slower (because of no GPU parallel processing, etc) I assume the particle system will work on a Canvas renderer instead of WebGL - but will not be nearly as performant.
  15. I found a way to make it work: //changing this.load.spritesheet('level_tm', 'level_tm.png',{ frameWidth: 32, frameHeight: 32 }); //into this.load.image('level_tm', 'level_tm.png'); Fixed it. Though I still expect the first to also work (because for DynamicLayer it works fine - and I don't see why the first would be invalid)