English subtitles

← Factory - HTML5 Game Development

Get Embed Code
4 Languages

Showing Revision 6 created 05/25/2016 by Udacity Robot.

  1. The resulting code is much cleaner, easier to maintain, and simpler to
  2. understand. We have our factory class that's been defined at top. The
  3. spawnEntity function still takes a string that contains the typename and the
  4. class definition. Which is looked up against the factory hash table that we
  5. previously filled in with the class. This is all used together to create a new
  6. instance of that entity object that's returned from spawnEntity.