How do I Doing something like select case??

  • i need to do something like select case or more than 2-3 if.

    How can I do it?

    I need to create a random number between 1-5 and if that 1 then do something if it 2 do something else and so on

    PS

    It's not about the question but Congratulations to myself I bought a license

  • I'd say for 5 values just do if-elses. However I think there is a 3rd party plugin for switch/case structure, if you're desperate.

    Well done buying a licence. Are you doing mobile or pc games?

  • I'd say for 5 values just do if-elses. However I think there is a 3rd party plugin for switch/case structure, if you're desperate.

    Well done buying a licence. Are you doing mobile or pc games?

    i do pc game for web can you give me an example of if-elses because I did not understand how to do it (I am new to this software)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You better read the manual and just play with some code. Also most if not all the official sample projects will have if-else (although, there's no actual 'If' but there is an 'Else')

    e.g:

    Sprite: myVar1 = 1 -> <do something 1>

    Else

    Sprite: myVar1 = 2 -> <do something 2>

    Else

    Sprite: myVar1 = 3 -> <do something 3>

    etc.

  • codah ,@maordany ,

    I am facing a similar case where there are 7 outcomes based on the values of a numeric variable.

    Question When I try using if else- do I add the second and subsequent conditions by first adding an else block and then editing that condition into a comparison ? or do I ad the second comparison as a sib event to the else ?

    In any case I am not able to add the else for the third condition.. Any help ?

    I tried using a plugin developed by Wastrel but it doesn't show up even after being added to the plugins folder.

  • UpendraWatwe, i have updated the plugin and example links on the SwitchCase Plugin topic. Let me know if you can't get it to work.

  • Thanks Wastrel

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)