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…

--

--

--

A new tech publication by Start it up (https://medium.com/swlh).

Recommended from Medium

Sentiment analysis of Joker reviews using Amazon Web Services from R

If You Are Learning Golang, Remember These 10 Commands

WHICH ONE TO CHOOSE: FLUTTER OR NATIVE?

Updating the PackageReference entries in the C# project files without running Visual Studio

Getting started with Swift 5.0

Integrating SonarQube with PostgreSQL Database and pushing data to ELK Stack.

Method Overloading and Method Overriding in Python

Languages for the win — Part 1!

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

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

More from Medium

2D Light Flicker in Unity

Re-coding Pong in 30 minutes! (Unity/C#)

Did you just hit me! — Hitbox attack system in Unity2D

C# Building Blocks: Methods