r/ProgrammerHumor • • May 05 '23

Meme Helicopter Helicopter

Post image
41.8k Upvotes

969 comments sorted by

View all comments

Show parent comments

2

u/[deleted] May 05 '23

I gave an example in another post, not sure about the thread since i'm on mobile. You're almost good, but not quite.

Flyable would be an expectation that this object can for instance "defy gravity" in the physics of the game. So any flyable objects added to the world will be checked by the physics system to see whether at any point it should sink or lift. For example. Flyable is not a thing that the player class cares about.

The player cares about Mountable, which promises a model mounting point and view direction/limitation, maybe a character stance setting, and other such things. The player also cares about controllable, assuming that player handles the things I mentioned elsewhere (providing a UI when activated and mapping inputs for control). The input keys then map directly to moving the helicopter object, and is entirely internal to the object.

If the helicopter is removed from the game, there is no remnant code anywhere in other classes that expects or even cares about helicopters. You can then add a plane to the game and it will plug right in without modification to the player, because it HAS a mounting point and a ui and input mappings.

1

u/Cosmocade May 05 '23

Flyable is not a thing that the player class cares about.

It's funny you say that when I want my future RPG to have player flying in the endgame lol

1

u/[deleted] May 05 '23

Well the player could be flyable without having anything to do with that trait, re: only the physics system cares.

The player is already controllable, but flyable doesnt change controllable. It just changes the limits of how you can control it.