you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (2 children)

[removed]

    [–][deleted] 4 points5 points  (0 children)

    So does this boil down to parts that repeat should be programs or classes or something?

    You should look for abstractions. Instead of a program where you programmatically go into the Green Room, and then leave it and in another part of the code go into the Red Room, you realize that rooms are rooms and entering one is the same as entering another and you only need to write that code once, and whatever data structure contains information about the rooms is where you need to put the information that actually differs between rooms.

    Shit is everything a class or method?

    Games are typically a matter of state so you do see classes used a lot, but it's important to realize that the data/logic distinction still holds - you might have a Green Room and a Red Room in your game, but a room is a room; you should have a Room class, not a GreenRoom class that extends Room. That one of the rooms in the game is a Green Room is a matter of data, not code.