Computer Science Canada Player Controls |
| Author: | Kodiakwarz [ Tue May 31, 2011 9:07 pm ] |
| Post subject: | Player Controls |
What is it you are trying to achieve? <I'm trying to make an option in my bomberman game so that you may change the controls of a player because certain people have certain preferences. I was just wondering if somebody could give me some base code and/or explain to me how to do this since I have tried and failed miserably so I'm am turning to the good people of comsci for help> |
|
| Author: | DemonWasp [ Tue May 31, 2011 11:33 pm ] | ||||
| Post subject: | RE:Player Controls | ||||
Right now, you probably have some code that looks like the following, assuming you're using Input.KeyDown():
You should change it to:
Then you need to have a separate settings file that your program can read. Then you need a way for a human to change the file. Either it should be possible to change the file manually (human-readable), or your program should be able to change it for the user (or both). |
|||||
| Author: | Raknarg [ Wed Jun 01, 2011 10:19 am ] | ||
| Post subject: | RE:Player Controls | ||
If you wanted to have a choice between arrow keys and chars, you would use 2 if statements.
Chars and KEY_LEFT_ARROW aren't interchangable (as far as I know), so its a bit more difficult to use them at the same time. |
|||
| Author: | Raknarg [ Wed Jun 01, 2011 10:21 am ] |
| Post subject: | RE:Player Controls |
You could even make it simple and ask the user for their key preference (either arrows or WASD). |
|