Jump to content

simple enemy gameobject in phaser 3


jasper1990
 Share

Recommended Posts

I am trying to get some ideas on designing enemy movement patterns in phaser 3.  First, I am trying to separate everything into discrete files such as custom game objects, scene, then the actual game file.  I thought about using state machines and ran across this https://github.com/jakesgordon/javascript-state-machine. I kind of want something modular yet extandable. Should, I just put the path for each  NPC and Enemy in a JSON or XML file?

 

thanks!

Link to comment
Share on other sites

You might want to look into javascript modules, or es6 modules, or commonJS modules. There are many different articles out there about JS modules.

In some ways it ramps up the complexity as you'll need a build system of some sort (modern browsers do all understand es6 modules, but, well, its still tricky) but its easily the cleanest way of modularising a project and the benefits outweigh the costs if you're building anything non-trivial (it is a bit of a ramp up at first, or, at least, it can be, depending on your experience).

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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