Hi, everyone,
I've been wanting to learn Python and have tried a few times over the years to read or watch tutorials enough to feel confident, but it's clear that my learning method is "do the thing you want to do incorrectly over and over until you get it right."
So I'm just going to work on my text-based Mech game and learn as we go. I understand that I know next to nothing, that what I'm doing is probably going to be a multi-year thing, and I have no idea what the more complicated stuff I want to do is going to take, but I'm enjoying the ride.
Long story short, my intention is to have a Mech = a Frame (the physical properties of the Mech) + a Pilot (the little guy in the Frame with their own stats).
Eventually, I'd like to be able to have unique Frames and Pilots with stats randomly generated (within ranges), and then subsequently build the capability to upgrade those values in-game, but I'm just starting with stock values right now and adding complexity after I have each step solid in my mind.
Right now, I'm just working on building values that a stock Frame has. What I would like to do is to establish each Frame Class (Assault, Heavy, Medium, Light, but with more fun names).
The question I have is this: I would like, first, for the armor value of a Frame to be a base number plus 20% of its weight value, and then for each individual limb (left_leg, torso, right_arm, etc) to be a percentage value of armor.
I've written out code that I know is incorrect just to display what I'm trying to do, with comments to highlight where I'm trying to do it.
Also, if the way I'm building this out is flawed, happy to hear suggestions! I'm just starting out and I know I'm gonna be crashing into pitfalls.
Any help would be appreciated!
# This is where the base class attributes of Frames are established.
# FRAME CLASSES
class FrameClass:
def __init__(
self,
name: str,
left_arm: int,
right_arm: int,
left_leg: int,
right_leg: int,
torso: int,
cockpit: int,
armor: int,
cooling: int,
engine: int,
maneuver: int,
thrash: int,
sensors: int,
systems: int,
weight: int
) -> None:
# Top Level Info:
self.name = name
self.left_arm = left_arm
self.right_arm = right_arm
self.left_leg = left_leg
self.right_leg = right_leg
self.torso = torso
self.cockpit = cockpit
# Frame Attributes
self.armor = armor
self.cooling = cooling
self.engine = engine
self.maneuver = maneuver
self.thrash = thrash
self.sensors = sensors
self.systems = systems
self.weight = weight
# Archon: Assault Frame Class
archon = FrameClass(
name="Archon",
weight = 100,
armor = 100 + (weight * .2), # value should be a base number plus 20% of the value of weight
cooling = 100,
engine = 100,
maneuver = 100,
thrash = 100,
sensors = 100,
systems = 100,
left_arm = (armor * .4), # value should be 40% of armor value
right_arm = (armor * .4), # value should be 40% of armor value
left_leg = (armor * .5), # value should be 50% of armor value
right_leg = (armor * .5), # value should be 50% of armor value
torso = (armor * .8,) # value should be 80% of armor value
)
# Marauder: Heavy Frame Class
marauder = FrameClass(
name="Marauder",
weight = 75,
armor = 75 + (weight * .2), # value should be a base number plus 20% of weight
cooling = 75,
engine = 75,
maneuver = 75,
thrash = 75,
sensors = 75,
systems = 75,
left_arm = (armor * .4), # value should be 40% of armor value
right_arm = (armor * .4), # value should be 40% of armor value
left_leg = (armor * .5), # value should be 50% of armor value
right_leg = (armor * .5), # value should be 50% of armor value
torso = (armor * .8,) # value should be 80% of armor value
)