Jump to content

Player/Enemy objects for cross states


Recommended Posts

So I have a little game concept I've been making in phaser and I have the parts of it split into states such as main menu and levels, but what I have been doing is creating the Player objects and enemy objects and the such in each individual states as well as making animations for them.


This is very obviously inefficient I want to know how would I go about making an object for these entities to use it cross states :)

Link to comment
Share on other sites

Yeah thanks for replying!
After I posted I thought of doing something like that. Only thing is I'm not quite sure how I would go about including the entity in a new state. I suppose I would make a var in the state equaling to the player object. I suppose the thing I'm looking for would be doing something along the lines of creating a new instance of a Player class. Just not sure how to achieve this right now xD

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...