Learning OOP for boss fights

Im making a game that mostly revolves around boss fights. However, I’m trying to learn object oriented programming, although its still a bit confusing for me.

What situations would I use oop in for a game with multiple boss fights?

I would first have a Parent class known as Boss with basic properties such as healty,speed,power,etc.Then create functions which will produce visual effects like attacks.
Next i would inherent the parent class to be used in the children classes such as the multiple bosses your going to create then individually create special abilities and stats for the boss.

local Boss = {}
Boss.__index = Boss

function Boss.new(name, health, strengt, attack)
  local newboss = setmetatable({}, Boss)
  newboss.Name = name
  newboss.Health = health
  newboss.Strength = strength
  
  return newboss
end

function Boss:Attack()
  self.attack:Play()
end

return Boss

would this be something good to go off of?

yeah thats a good start then you can now develop the multiple bosses with different stats like mana or synergy derived from the boss class

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.