Nek0 Posted July 1, 2021 Share Posted July 1, 2021 this seems a rudimentary task, but i'm actually having trouble implementing a title screen into a game. i've saved this task for last thinking it simple, but i can't seem to find a way to do it cleanly. i believe the creation of "states" is involved, but i can't figure these out, and the one example on the phaser website is hopelessly confusing. everything in this project thus far is located in a single "game.js" file. i tried making a separate "title.js" and going from there, but perhaps this is the wrong approach. i simply want something that occurs before the game.js, shows a static image, and when anything is pressed (either keyboard or mouse) it launches "game.js". any example of this would be great. Link to comment Share on other sites More sharing options...
Nek0 Posted July 11, 2021 Author Share Posted July 11, 2021 seriously? no one on this whole wide site knows how states in phaser 2 work? i solved the prob without using states, but i still wouldn't mind hearing a salient explanation on how to use them. Link to comment Share on other sites More sharing options...
Horizonicblue Posted July 12, 2021 Share Posted July 12, 2021 Hi This is a short tutorial on which will help you on how you can organize states and basic structure in your game for Phaser 2 https://www.emanueleferonato.com/2014/08/28/phaser-tutorial-understanding-phaser-states/ Nek0 1 Link to comment Share on other sites More sharing options...
Nek0 Posted July 19, 2021 Author Share Posted July 19, 2021 thanks again @Horizonicblue, i've run into this tutorial before and it's still a bit convoluted for my tastes. i'll stare at it again though and see what i can extrapolate out of it. in the meantime i've coded things in a manner that avoids states entirely (except for the main game state). Link to comment Share on other sites More sharing options...
Horizonicblue Posted July 19, 2021 Share Posted July 19, 2021 (edited) Welcome, here is another example on states https://phaser.io/examples/v2/p2-physics/state-reset , in this example just see the structure of state and try to replicate with only one sprite and minimum amount of code that might help you understand it better. If you explore more there are lot of other ways of doing this as well. This is es6 way of doing https://www.joshmorony.com/phaser-fundamentals-using-states-in-phaser/ Edited July 19, 2021 by Horizonicblue Link to comment Share on other sites More sharing options...
Recommended Posts