Heptagono's Forum Posts

  • Interesting.

    Such thing could be done as well with two arrays?

    One of them for the sprites values selected by the buttons, and the other as a Registry. Comparing them we can solve the matter and modulate the opacity of the lasers.

    How do you like that?

  • Wow! That was the clue I was looking for!

    You're great! The issue is properly solved.

    Two thumbs up!

  • Hi, everybody!

    Look, now I'm at the final stage of a program.

    project

    I have applied a truth table.

    We can have some sprites present or not. These are the possible combinations:

    OOO

    XOO

    OXO

    OOX

    XXO

    XOX

    OXX

    XXX

    Where a 'X'means the sprite is visible, and the 'O' means it is not.

    The opacity of the laser beam changes depending on a formula that includes angles values for each sprite's instance.

    I have thought to act like in the 'case' operation in C or Java.

    But in this case...It seems that it does not work.

    Do you have any idea about the reason?

    Thanks a lot in advance. I left to you this project if it is usefull for somebody someday.

  • Here we are, again trying to finish this project. So far, we have done great improvements and advances learning about Construct 2. But, now things turn into something a bit more difficult.

    As you can see in the project, there are 3 sliders supposed to control 3 different sprites. While each slider shows its value on a different textbox, the value affects all the instances of the sprites. It's quite a mess.

    I would like to know, how to solve this. It is possible to assign each slider and textbox to an sprite instance? Is correct the code as it is now?

    Here the challenging project:

    project

  • Thanks a lot, man.

    When I have to pick up the value typed in the TextBox, I add this expression allowing me to avoid values under and over the range from 0 to 360.

    float(TextBox.Text)<=0? max(0,float(TextBox.Text)):min(360,float(TextBox.Text))

    I've used the expression that you have posted before, with this '?' and ':' that allows to program a condition with code directly on a line.

    And it works!!

    I find that this world of expressions gives a lot of power and flexibility to Construct2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • project

  • In the next post you'll find a link to the project

  • Hi, I'll try to send you a sample of the code.

    Now, the next step I'm looking foward is to limit the possible text entries between 0 and 360.

    Do you think it's a good idea to create another global variable and then compare it to this values?

    Or perhaps try to find an expression that could solve the issue without adding more variables?

    I'll keep to find the solution!

    Any extra idea?

    Cheers!

  • <img src="smileys/smiley32.gif" border="0" align="middle" />

    Keepee,your solution works great!! Thanks a lot friends!

    I had spent already some nights working out how to solve this issue without success.

    Two thumbs up!

  • Hi there,

       I'm using this formula to show results with two decimals:

              round(N*100)/100

    But...

    How could I show numbers this way?----> '456.00' instead of just '456'

    Best regards!

  • Hi, I think I've made a step more towards the solution! Here you have a link to the project:

    Sliders_Experiment.capx

  • Hey Yann,

    Thanks a lot. It's awesome.

    But still it's not possible to add a value directly from the textBox. Only using its buttons, but no way typing it. �Which changes should I make to reach this?

    Thanks a lot in advance. It would be great to have this available for all the scirra community.

    Cheers!

  • Well, hello everybody!

    I'm trying to make up a controller for sprites made of a slider and a TextBox, as you can see here:

    Image1

    Well, the code I've made is this one:

    Image2

    But it doesn't work. The most difficult part, from my point of view, is to pick up a solution that allows the user to use both the slider and the TextBox to enter values into the game. AND that can change the position of the slider WHEN the TextBox value changes. Thats the key factor.

    As long as I keep trying to solve this issue, I ask the whole community to help me with this daunting nightmare. ;)

    You can find the project here:

    Project capx

  • Well,

       Here we are stuck for real. We have an slider, which changes the value of a variable. This variable is shown in a text object. Using 'System--> every tick" the slider's value goes into the text object immediately.

    But, if we want to change the value of the same variable through a TextBox as an alternative of the Slider...Thing turns into something impossible. Apparently.

    So, we ask for your help!

    Here we have the code:

    capx

    Test

  • Hi Yann,

    How can I identify each one of the slider's instances that I use in order to send their values to a group of different global variables?

    I don't find the way to get their instance ID!

    Thanks a lot in advance.