Geek Culture
Published in

Geek Culture

Polymorphism using Interfaces: Damage Method

Objective: exploit the polymorphism to implement a modular damage system that can be applied to several kinds of game objects (or classes)

As I introduced before, our player can now perform attacks and has a cool hitbox around the sword that could detect collisions (trigger) with anything else.

The player can attack and hit an enemy but also a chest containing some loot and who knows how many other different objects. We can now take the decision to be bad-ass programmers or just bad programmers: would you overload the Damage…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Daniele Quero, PhD

A professional developer with passion for game developing and skill-growing. A former Nuclear Physics Researcher who changed his life to pursue his dreams