Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

OOP in game programming

$
0
0
Hey everybody, So I have a situation where the player object is attacking the enemy object. My question is, in terms of best practices, should the player hit the enemy, and the enemy detect if it was hit and then deduct it's own health, or should the player deduct the health of the enemy? I know that in OOP every class should handle it's own behavior, but I'm not sure what the correct answer of this question is. Also, could anyone point me to good articles on how to take advantage of OOP in terms of game programming? I want to write the best code I can. Thanks!

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>