The Daily Click ::. Forums ::. Klik Coding Help ::. keyboard imput main menu
 

Post Reply  Post Oekaki 
 

Posted By Message

Reale



Registered
  10/06/2010
Points
  2
17th June, 2010 at 21:59:34 -

ok, i am new to the hole MMF2 gig (and have never coded before, so even if its simplified in MMF2 i am still finding it hard) and have been following a few tuts on how to make simple games, i made a two player pong clone with a start screen, the start screen has three buttons and you use the mouse to click it... then tried to make it so the keyboard can control the menu screen using up and down.

i managed to get it to work with 2 options (having an image for both buttons of being selected and unselected) and i think i have grasped how to do it for three but i am unable to achieve my goal as of this moment.

so far i have 6 actives for 3 buttons (2 for each button, one selected and one not selected) i have an idea in my head how it could work but i dont know how to get it down in mmf2, my idea is binary, for instance;

if; A=0 if; A=1 if; A=1 I am now trying it so that pressing down changes the values but am struggling
B=1 B=0 B=1
C=1 C=1 C=0

and if the value is at 0 and the player press's space bar the action is executed... my only problem is i don't know how to get this idea to work... does anyone have any suggestions or help? (i have looked for a while online for an answer but havent come across one) i even downloaded peoples games and opened em up to see how they did it but most of them have mouse controlled main menues

 
n/a

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
17th June, 2010 at 23:20:59 -

You could do something like this using 3 actives and a single counter. In my example each active object will act as a button by having both a "selected" and an "unselected" animation.

--

Start of frame -> counter = 1

Always -> Set active 1, 2 & 3's animation to "unselected"

Always
+counter = 1 then set active 1 animation to "selected"

Always
+counter = 2 then set active 2 animation to "selected"

Always
+counter = 3 then set active 3 animation to "selected"

Upon pressing the "UP ARROW"
+Value of counter > 1 -> sub 1 to counter

Upon pressing the "DOWN ARROW"
+Value of counter < 3 -> add 1 to counter

Upon pressing "SPACE BAR"
+Value of counter = 1 -> (do whatever the 1st menu's choice is)

Upon pressing "SPACE BAR"
+Value of counter = 2 -> (do whatever the 2nd menu's choice is)

Upon pressing "SPACE BAR"
+Value of counter = 3 -> (do whatever the 3rd menu's choice is)



Edited by Del Duio

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Reale



Registered
  10/06/2010
Points
  2
18th June, 2010 at 02:30:34 -

super big thanks man... I can now see my two biggest mistakes, one i forgot about the animations (which overcomplicated things) and the second was that i thought being my code like (binary) over my original plan (very similar to the solution you gave) means i should just try whats more natural and if it works it works and after see if you can make it neater!

it makes so much sense now you have spelled it out to me thanks for the help man!

 
n/a

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
18th June, 2010 at 04:43:06 -

No problem!

I don't know if the way I do things is the "right way" but really as long as you get the result you're looking for who cares right?

Good luck to you.

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!
   

Post Reply



 



Advertisement

Worth A Click