User Define keys in a game
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: User Define keys in a game
Why even use strings anyway? You could have replaced all those occurrences of "P1Left" etc. with P1Left etc., as you use those strings only as some sort of "references" to functions, for which you can use the function's name as well.
Help us help you: attach a .love.
Re: User Define keys in a game
it's because the user starts by selecting a player (P1 to P4) and an action (Right, Left, etc). The info is stored in the string and then the key he presses is binded to this.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: User Define keys in a game
I think it would then make sense to have a keyfuncs table with this layout:tido170 wrote:it's because the user starts by selecting a player (P1 to P4) and an action (Right, Left, etc). The info is stored in the string and then the key he presses is binded to this.
Code: Select all
keyfuncs = {
P1 = {
Right = P1Right,
Left = P1Left,
(...)
},
P2 = {
(...)
},
(...)
}
... but on the other hand, this might not make any sense. Feel free to ignore me if that's the case.
Help us help you: attach a .love.
Who is online
Users browsing this forum: No registered users and 3 guests