agKing_21
(agKing_21)
January 9, 2025, 6:16pm
8
Vanni:
This looks like an incorrect usage of class inheritance.
Also, ideally, this shouldn’t be done with OOP, but let’s walk over it anyway:
If FallMode inherits from GameMode, then the latter should be able to handle all modes that inherit from it. You should probably structure your classes so that
A. All game modes run using the same method under GameMode class and
B. Each mode still has their own logical callback that we can set using a constructor.
I don’t think I need a constructor for this specific scenario since I don’t have specific properties like self.timerCountdown, self.alivePlayers etc. it would be hard for my scenario I’ve watched this specific thread on OOP
ALL ABOUT OOP!
Prerequisites
An understanding of meta-tables (although the required code will be explained)
How tables work and a competent grasp of the Lua syntax
Parts
What is OOP?
How does it help me?
How do I make this work in Lua?
Integrating with module scripts
What about inheritance?
What is OOP?
OOP stands for Object Orientated Programming and is a way of laying out code in a more friendly way whilst also keeping large projects organised. You have used objects in pro…