How to make a individual code move library efficiently?
Asked by
4 years ago Edited 4 years ago
Hey! I'm working on a project for myself revolving around turn-based combat. I was wondering what's the best way to select an attack through several different moves library?
All moves are different so the code has to be individual. What I'm doing right now works but I'd like to learn to be more efficient or this is the only way, which I doubt.
To put it brief, here is what I am doing:
01 | local function MOVE_LIBRARY(ATTACK_NAME) |
02 | if ATTACK_NAME = = 'Attack1' then |
04 | elseif ATTACK_NAME = = 'Swipe2' then |
06 | elseif ATTACK_NAME = = 'Punch0' then |
11 | MOVE_LIBRARY( 'Attack1' ) |
I don't believe tables would work to this degree since again, they are specific.
To me this seems very messy and inefficient, is there any more efficient way to do this or am I overthinking this? If I am being to unspecific just let me know! Thank you!