Skip to content

Instantly share code, notes, and snippets.

@LionGet
Created October 22, 2023 17:44
Show Gist options
  • Save LionGet/8a015d12ee3ba9e6f04631ed3be28957 to your computer and use it in GitHub Desktop.
Save LionGet/8a015d12ee3ba9e6f04631ed3be28957 to your computer and use it in GitHub Desktop.
Creature class with attack interface
creature:=class<abstract>:
Stats:stats
Attack:attack
stats:=class:
Health:float
Shield:float
attack:=interface():
Attack():void
attack_melee:=class(attack):
Attack<override>():void=
Print("Melee Attack")
attack_ranged:=class(attack):
Attack<override>():void=
Print("Ranged Attack")
zergling:=class(creature):
Attack<override>:attack_melee
hydralisk:=class(creature):
Attack<override>:attack_ranged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment