mardi 26 avril 2022

Game Development Design Patterns

I'm fairly good at programming and can make some pretty advanced stuff, but I suck at design patterns and making things very extendable, But I always get overwhelmed on projects to the point where I just quit because my code is so messy.

So lets say there's an item in your game, you can grab it, drop it, and throw it. I also want there to be tools, lets say a grapple hook so you can grab an item from farther. And something that is hurting my brain the most, lets say you can get a power up to throw an item farther.

This is what is going through my mind. You can grab, drop, and through and item, that simple and easy. Then when you have a tool equipped like a grappler, you can grab it from farther by grabbing the item with a farther grab distance. But then when you throw an item, I would just check if I have a power up and if I do then I can throw it farther. But I want this to be easily extendable, so what would happen if I had to check through other power ups to, well then the code starts getting messier and messier.

What would be the cleanest/most-extendable way to design this?

Aucun commentaire:

Enregistrer un commentaire