|
| 10 Apr 2016 05:48 PM |
Have you guys ever used this?
I'm thinking of doing a zombie storyline game (like Undead Nation or Defenders of Roblox).
I think the best idea would be to have a zombie class where different types of zombies can inherit from the zombie class.
What would you think about that? An OOP design for a game like that?
|
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 06:03 PM |
Use metatables. I use OOP religiously (not literally).
http://wiki.roblox.com/index.php?title=Metatable |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 06:05 PM |
Yeah metatables are an essential requirement of OOP on ROBLOX.
|
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 06:06 PM |
| OOP and ModuleScripts can seriously organize a game. I'd use FE to top off your good programming habits. |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 06:08 PM |
Everything I've made for a few years now has been FE.
The only other thing I'm thinking of right now is expanding OOP to encompass the entire game, more than just zombies.
Perhaps objectives can use OOP? There's be different types of objectives which would inherit from the objective class.
And character classes can inherit from the main character class.
Hell, why not guns? Guns can inherit from a Guns class which inherits from a Tools class.
OOP is pretty exciting to me.
|
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 06:11 PM |
| You can create whichever class system you desire. You can even place classes into modules, and if they are a child of another class module, they can inherit. That's one way to do it. |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 10 Apr 2016 06:14 PM |
OOP <3
class Zombie { private string name; private int age; private float damage_per_hit;
public Zombie(string name, int age, float damage) { this.name = name; this.age = age; this.damage_per_hit = damage; } }
static void Main() { Zombie Frank = new Zombie("Frank",16,2.44); Zombie Dorthy = new Zombie("Dorthy",4,0.001); }
Why did I post C# code? I felt the inspiration! |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 10 Apr 2016 06:16 PM |
| That's nice of you to give names to your zombies. |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
| |
|
|
| 10 Apr 2016 06:19 PM |
| You say it's C# code but you don't denote your floats as floats when you write them, surely this causes compiation issues? |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 10 Apr 2016 06:20 PM |
| Oh crud, I forgot Right ;-; |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 06:22 PM |
@RoflBread
They were humans at one point. They had families.
:(
|
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
| |
|
|
| 10 Apr 2016 06:29 PM |
My game's OOP designed, I suppose:
Class Zombie -> Class Zombie -> Class Tank -> Class Witch -> Class Smoker etc.
Class Tool -> Class Gun -->Class AK-47 etc. -> Class Melee -->Class Katana
Honestly I can make my whole game OOP. Interesting.
|
|
|
| Report Abuse |
|
|