How do I create a radiobutton

0 favourites
  • 6 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • i need to create a radio button, because with checkbox option of the button plugin a can check more than 1 check box and i need only can check 1 at time.

    thank you for your help guys.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi, if you want to use the button object for your radio buttons, you can do this

    Create three buttons: button1, button2, button3, set the type for all buttons to checkbox.

    Event\Actions:

    button1 - On clicked >

      button2 Set unchecked button3 Set unchecked

    button2 - On clicked >

      button1 Set unchecked button3 Set unchecked

    button3 - On clicked >

      button1 Set unchecked button2 Set unchecked

    Or you could do it with sprites. . . .

  • michael thank you, but if i have a lot of checkbox like 100 o more?

  • I have some radio-style buttons in my current project. The absolute easiest way is, in psuedo-code

    function onButtonClick

    • all buttons Set unchecked

    button0 -> onClick

    • Function.Call("onButtonClick")
    • button0 set checked
    • radio variable - set 0

    button1 -> onClick

    • Function.Call("onButtonClick")
    • button1 set checked
    • radio variable - set 1

    etc

  • michael thank you, but if i have a lot of checkbox like 100 o more?

    I always use images for buttons - just my preference, so for a bit of fun I created an example using images for the radio buttons, based on what I do in my apps.

    However I don't have that many options in my games so it may not be what you are after - but it might give you some ideas to go on.

    Note the example is built using R165.

  • I have some radio-style buttons in my current project. The absolute easiest way is, in psuedo-code

    function onButtonClick

    - all buttons Set unchecked

    button0 -> onClick

    - Function.Call("onButtonClick")

    - button0 set checked

    - radio variable - set 0

    button1 -> onClick

    - Function.Call("onButtonClick")

    - button1 set checked

    - radio variable - set 1

    etc

    nusbaumc maybe this work with a family ??

    example

    function onButtonClick parameter 0 (id)

    for -> buttons instance count

    button id =/= id

    -Set unchecked

    buttons -> onClick

    • Function.Call("onButtonClick(buttons.id)")
    • radio variable - set 1
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)