#OOP combat system inheriting individual moves

5 messages · Page 1 of 1 (latest)

ember wind
#

I'm new to OOP, I am trying to find a way to combine individual moves to make up a class.

I was thinking a code along the lines of ```lua
-- MOVES
local block = require(block)
local counter = require(counter)
-- CONSTRUCTOR
local playerClass = {}
playerClass.__index = playerClass
function playerClass.new()
...
end

Then, how should I put in the moves block and counter into it? Sorry if this is a weird/no sense making question. This is somewhat of the function I am looking for afterwards, ```lua
local playerClass = require(...)
tool.Activated:Connect(function()
  playerClass:block()
  playerClass:counter()
end)
granite owl
#

studio** You are now Level 5! **studio

toxic marsh
#

by adding them as methods

#

function playerClass:methodName(...)

#

alternatively function playerClass.methodName(...)