11 March 2016 - Forum Rules
Started by InfamousKnight, July 28, 2012, 06:12:34 PM
Quote from: Klarth on July 28, 2012, 07:42:16 PMMay I suggest creating an array of structs that contains all ability names, function pointers to a damage calculation function, so you can clean up your battle loop?
Quote from: Ryusui on July 29, 2012, 03:38:19 PMIt's simple enough, really.In game development, you might have a "Game Object" class with a function called "Update" which handles everything a given object needs to do on a given frame. The game's main loop calls "Update" on every single Game Object (or, if we're clever, just the ones on screen), but the twist is that we don't actually use the base Game Object class - we use derived classes, like "Player" or "Bullet" or "Powerup" or "Enemy," which override "Update" in their own specific ways. When you tell a Player to Update, it might read the controller/keyboard input and move accordingly; when you tell an Enemy to Update, it might follow its AI instead. The point, however, is that each of these objects can be treated as a "Game Object" by the rest of the program; they feature the same functions, even if what those functions actually do is different.
Page created in 0.063 seconds with 20 queries.