The Daily Click ::. Forums ::. Klik Coding Help ::. Change controls for player.
 

Post Reply  Post Oekaki 
 

Posted By Message

LordHannu

Crazy?

Registered
  22/04/2007
Points
  7910

VIP MemberStarTeddy BearRibbonGame of the Week Winner2021 Halloween Competition Winner2022 Hi-Score Mash-up Competition (Bronze)2023 Halloween Competition (Bronze)2023 Halloween Competition Entrant
31st January, 2015 at 31/01/2015 15:15:24 -

Change controls for player.

I want to give possibility to change controls.
How do i get the player input key as a variable?
example i want to change an orginal key push for an attack from key ( A ) to key ( S ).
Wish to have that option for the player.

Thanks for the help.


 
n/a

nivram



Registered
  20/07/2006
Points
  171
31st January, 2015 at 31/01/2015 18:21:56 -

From my MMF Tech Manual:
Allowing User To Define Keys In Game -
You would like to allow users to define the keys in-game rather than using the regular menu? You would also like to have an options screen where keys are defined in there.
Solution:
Use the Control X Object. You can ask for a key to be pressed and then use this to determine the last key pressed: LastKeyPressed$( "Control X" ). The Control X Object allows player to change the controls.

After you add it use this code -

player, set"key"

"LastKeyPressed$( "Control X" )"

Marv

 
458 MMF2 & CTF 2.5 examples and games

http://www.castles-of-britain.com/mmf2examples.htm

LordHannu

Crazy?

Registered
  22/04/2007
Points
  7910

VIP MemberStarTeddy BearRibbonGame of the Week Winner2021 Halloween Competition Winner2022 Hi-Score Mash-up Competition (Bronze)2023 Halloween Competition (Bronze)2023 Halloween Competition Entrant
31st January, 2015 at 31/01/2015 20:40:09 -

Works great thanks Marv!

 
n/a
   

Post Reply



 



Advertisement

Worth A Click