One day when I wasn’t at a computer I began to write down how I would design a very basic “game” and was curious as to how you guys would do it.
Basically, the idea is that there is a player who can walk around a world and there will be items that he can pick up and use against other items, one of which would be a Door, that the player can bash open with the hammer and that is basically it. I wanted to keep it simple so I can just try and see how I would do this and make it expandable.
The way I decided was to have an Entity class that would represent all of the Objects in the game which would contain information such as location, bounding box, and “Strength” which every entity will have (if you hit the door with a hammer it will compare strengths and break) and then the player, item and Door would extend that.
Some problems I have had was that if the Player has a hammer “inHand” and hits a door, do I tell the door it was hit with a hammer or do I tell the hammer it hit a door? I figured I will tell the Door, because the Door will know what to do if it is hit, while the hammer does not care what it is hitting. Although I guess you could tell both objects?
And also, if someone wanted to turn this into a Tile Based game, how would they do so, would the levels just be a 2D array of “Entities”? on the item layer? that way if the player clicks on a tile, it will cycle through all of the items on the Item Layer and then do whatever it needs to do?
I dont know, I just like to think about these kind of things and see how other people would implement them, hopefully some of you find it somewhat interesting