• Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by nkholski

  1. Yes. One pro with this approach that while the tile is replaced with a sprite it's trivial to check collision between that and other sprites allowing you to jump under enemies and destroy them. Right now crushing a brick won't kill an enemy above the brick because I just remove the tile. This could be solved to do exactly as when bumping the brick but setting the alpha of the temporary sprite to 0.
  2. You have to dig in the code and that part is a bit messy I think. A callback is fired when Mario collides with a tile, if he moves upwards and the collision is from above it will hide the tile and put a sprite at its position which is tweened up and down. When the sprite has returned to the original position it's removed again and the tile is made visible (don't remember if I use alpha on the tile or something else for this). The sprite is called SMBTileSprite which is a stupid name not to confuse with Phasers tileSprites. The implementation isn't that great. If I remember correctly there can currently only be one sprite of this kind, and this sprite should be in a pool to allow multiple simultaneous animations.
  3. Thanks. I thought really hard before I came up with the idea of mushrooms, pipes and fireflowers ;-). Nothing is forcing the canvas to 1600px. The size is determined by main.js (game size), some css in index.html (margin and stuff) and then the titleScene (scale canvas to fit).
  4. @mistertabasco I use an Spriteatlas for most sprites but Mario is still in that spritesheet because I've prioritized other stuff with the little time I got. I suggest that you study the folder structure in raw assets and try texture packer. The key is generated from the path and filename. Why not practise by splitting up the Mario sprites in a folder, generate an updated Spriteatlas from that and share it ;-).
  5. I just pushed a long overdue update to the GitHub repository. The source code itself is untouched but it now runs on Phaser 3.12 and Babel 7. I noticed that this introduced some issues related to Arcade Physics. I wouldn't say that the controls were tight before, but they are definitely less tight now. There is an issue when trying to walk into a wall (like a pipe) and when you enter a pipe the horizontal velocity might make Mario fly away. The attract mode is a bit broken, but since deterministic physics where introduced in Phaser 3.10 or something, it could also be improved beyond what it has been. I won't have time to update the repository any time soon, but I gladly accept pull request fixing anything of the issues above if you feel up to it.
  6. @phaserlover I think you might have missed http://labs.phaser.io/index.html
  7. You can achieve it with collision callbacks. Read my answer here:
  8. You could set a callback for the tiles, make a collision test of your own in the callback function. If all sides of the tile should be collidable, return true immediately, otherwise check where the tile is overlapped and return true only if it's where it's solid (maybe just check for collisions, and if it reach the end of the function return false). I never used Tiled in that way but you should be able to navigate through the tilemap object (or cache) to find the information you refer to and implement that in your callback.
  9. I've done some work on reorganizing and otherwise improve the code, but when the code got really messy (by the end of the Game create method) I lost focus a bit and couldn't resist implementing fire Mario. If you're using this, what would you prefer: Improved code base or additional features? The online demo was also updated:
  10. I made a repository with a starter project for creating Phaser 3 plugins (Phaser 3.8.0+): Demo for testing your plugin with dat.gui integration for easy testing. Build script to build uncompressed and minified versions of the plugin (with source map) Webpack 4 ES6 support This is a cleaned up version of what I've been using for my Grid Physics and Animated Tiles plugins. Feedback and suggestions are appreciated. Clone it with git: https://github.com/nkholski/phaser-plugin-starter
  11. @B.Guyl The webpack-stuff of repository a clone of a Phaser 2 boilerplate which I've managed to get to work with Phaser 3 through trial and error. I'm not a great source for webpack best practises. 🙂 (1) No idea. It's just kept as it was in the original repository. (2) I don't really understand the question. I prefer a source folder with content that should be transpiled, a static folder and a build folder that everything get copied to. I load the assets with the Phaser 3 file loader. (3) @snowbillr got you covered 🙂
  12. I added a link to this thread and the codepen to the issue I mentioned above (https://github.com/photonstorm/phaser/issues/3547)
  13. I'm using the es6-version. Great work. Sometimes it seems that it fails to wait for all imports though. I'm working with a button class and get this error now and then "menu.js:35 Uncaught TypeError: _button2.default is not a constructor" which resolves if I just save the file with the button class again unaltered. It was a thread here about making an official template. I think that's a great idea and maybe this could be a candidate? How does the build compare to webpack? I think an official template would get much more attention from the community, with examples on how to extend it and PRs to keep dependencies up to date.
  14. Might be related to this issue when zooming in: https://github.com/photonstorm/phaser/issues/3547
  15. Added support for levels (walk on or under a bridge) and updated the online example git-page today. Also replaced the image in the first entry of this thread with three gifs.
  16. A proper Phaser 3 demo is now online on http://metroid.niklasberg.se/P3GridPhysics/ and I added turn-based mode toggled by dat.gui. You may also test things like setting a limit for the number of bodies the player can push, strength and velocity.
  17. Thanks! Will try to upload a proper Phaser 3 demo until then. It'll be similar to the existing Phaser 2 demo minus pathfinding plus a few bugfixes and a working turn-based mode. With some luck, I'll manage to add z-index so that you can walk on or under a bridge.
  18. Thanks! It's a plug-in with a demo, not a game to play. All you can do is walk around, test collision and push boxes. What do you mean with autofocus?
  19. The Mario example was made mainly while Phaser 3 was in beta and much by trail and error. That line should be removed because it does nothing (I found https://codepen.io/samme/pen/JMVBeV and tried it in my game with no success). I should really sit down and clean up the source. I ended up making a custom method to scale the whole canvas.
  20. I've published the first version of my grid-based physics plugin for Phaser 3 (a port and improvement from the Phaser 2 version). It makes it easy to create a game where the movement is restricted to tiles or a grid and comes with helpful built-in features such as a system for pushing objects or walking on one-direction tiles. I'm making the plugin to use it in a RPG I'm developing but it's suitable for everything from Sokoban-like games to Rouge-like. However, the development of the plugin will be focused to add features I need and fixing bugs that affect my game. Let me know if you use the plugin and feel that stuff is missing or if you run into issues. I won't be adding stuff just for the sake of the plugin unless there is a demand. 1. Testing a bridge and tiles will collidable borders. 2. Testing one-way collision (and I got stuck). 3. Turn-based mode with smooth animations. Multiple bodies getting pushed. DEMO http://metroid.niklasberg.se/P3GridPhysics/ (Use dat.gui to toggle turn-based mode, maximum number of bodies the player can push, velocity and more) Github: https://github.com/nkholski/phaser-grid-physics
  21. I've tried to put my assets folder in static but I get a 404 when trying to load an image: "/assets/image.png".
  22. Just tested it. Worked great to install (except it had a conflict against other service using port 8080). Is it possible to keep assets out of the src folder and avoid using import?
  23. @Vlas @jorbascrumps I think it's a good decision not to call an update-method for all game objects (even if I was used to this from Phaser 2 and was quite confused why my code didn't work initially with Phaser 3). I hope we get a standard method to do this, like gameObject.runUpdate(true) to push it to an array of objects that get updated for each loop (and gameObject.runUpdate(false) to remove it again). However, doing it yourself as I do isn't that complicated either. It's probably a quite common bump on the road for those going from Phaser 2 to 3 though. @msickle The code is in the source code. I planned to clean up the code but couldn't stop myself from doing this instead, thus with a messier source code. The attract mode is the actual game stage running in parallel of the title screen with muted music. If you study it you see that you can activate a function to record keystrokes and positions of the player. Arcade Physics isn't deterministic and this was a big challenge, that's why I need to copy the position and velocity and not only keystrokes. I played the game while recording the keystrokes to a global variable. When happy with the result I did JSON.stringify with the object and I copied the output to a JSON-file. When running in attract mode I keep track on time and simulate keystrokes from the imported JSON and I adjust the position and velocity of Mario too to adjust it to what it was when I played. You can try to comment out the adjustment of position and velocity if you want and you'll see how soon it'll freak out. The enemies aren't controlled by anything else than game logic which means that Mario could be killed or miss a jump (he almost always fail to jump on the second goomba in the pair just before the first hole, my JSON seems to adjust Mario just in time to miss the enemy each time but sometimes Mario manages to squash it). It's far from a perfect solution but it was fun to make and good enough to keep in the demo I think :-). @Everybody: I'm super happy to see so many of you have used the repository. I mean 200+ stars is crazy! I didn't expect that. I've been busy with other things but hope to be able to return soon to update the code to Phaser 3, go through everything for readability and move misplaced code where it belongs. And of course, most probably get obsessed to add something new that makes everything into a mess again.
  24. If your deadline is one month away and you're new to phaser and game development in general I would suggest Phaser 2. Otherwise I would really recommend Phaser 3. The claim that the industry would consider it a "release candidate" juat isn't true. It is a proper release and there is no reason "the industry" would call it something else. Anyone with such professional experience can easily pick up phaser 3 and create a game today based on examples and peeking in the source code now and then, and I think that goes for a lot of amateurs too.