rtlehr Posted November 13, 2014 Share Posted November 13, 2014 Hey All, So, I'm creating a simple "Defender" like game as my "Learn Phaser and game development" project. I'm going to have a hero ship, humans, and UFO's. The basic premise is the hero needs to shoot all the UFO's before they can abduct all the humans (and do all kinds of nasty things to them). I have a "world" class that creates the Hero, Humans and UFO's. The world class is intended to keep track of the game and allow all the entities to be connected to each other. The logic for the ufo's is simple. If there is a human that does not have a UFO trying to abduct it, go after that human, but if all Humans are taken by a UFO, then go after the hero ship. My question is, Should the AI for the UFO live in the world class, or the UFO class? In other words, should the world class look at what is going on and then tell the UFO's what to do, or should the UFO look at the world (are the humans all taken) and then decide for itself what to do and let the world know? If there is a site that gives info about AI I'd love to have a link. Also, I know this is not really a "Phaser" question, so if this is the wrong spot for this post, I'll happily move it. Thanks!Ross Link to comment Share on other sites More sharing options...
CtlAltDel Posted November 13, 2014 Share Posted November 13, 2014 This link gives you some insight into state machines. Which should help you make a finite state machine for your game. (which is what you're looking for)http://gameprogrammingpatterns.com/state.html Link to comment Share on other sites More sharing options...
rtlehr Posted November 13, 2014 Author Share Posted November 13, 2014 Thanks!! I'll take a look. Ross Link to comment Share on other sites More sharing options...
rtlehr Posted November 14, 2014 Author Share Posted November 14, 2014 That link helped a lot. Thanks!! below is a page that has the "Gang of Four" design pattern in Javascript (just incase anyone needs it.) http://www.dofactory.com/javascript/design-patterns Link to comment Share on other sites More sharing options...
Recommended Posts