Sam Dimanche's Recent Forum Activity

  • Hey Plinkie, thanks for your answer

    Yes it works like that of course, but that doesn't explain why it doesn't work the other way around. It's more a question of principle at this point.

    Plus I shared a very simplified Capx, in my actual project it is easier to check for the variable and then check for the input. It worked perfectly with a gamepad and when I tried to duplicate the events to handle the keyboard it started bugging.

    I could change everything of course, but I don't want to do it before I know why it wasn't working in the first place ^^

    Blackhornet >> Thanks for your answer. I understand what you say, but I've coded small games before with lots of buried triggers (keyboard and gamepad related) and it worked just fine :/

    Now that I'm looking at one of my old projects, I realise I never used any trigger of the sort underneath an "Else" statement though, so everything seems to come from there...

  • I there,

    I've encountered a problem using an "Else" expression.

    Basically I have :

    [quote:2hrbkc1c]Global Number variable = "1"

    IF (variable = 1)

    --> Key "Enter" is pressed --> Call Function Addtodebug "AAA"

    ELSE

    --> Key "Enter" is pressed --> Call Function Addtodebug "BBB"

    Problem is : if I press Enter... I'll see "AAA BBB" in the debug text box oO

    I've been using construct 2 for a while now, and this really surprises me. Why doesn't the "Else" expression filter the keyboard input there ?

    Also it seems to bypass everything else in the "Else" subevents because if I add this :

    [quote:2hrbkc1c]IF (variable = 1)

    --> Key "Enter" is pressed --> Call Function Addtodebug "AAA"

    ELSE Call Function Addtodebug "Random Text"

    --> Key "Enter" is pressed --> Call Function Addtodebug "BBB"

    If I press Enter... I still see "AAA BBB" in the debug text box. The "Random Text" part never appears.

    And to put the nail in the coffin : everything works PERFECTLY if I'm using a Gamepad and Gamepad inputs. Thus :

    [quote:2hrbkc1c]IF (variable = 1)

    --> On gamepad 0 Button A is pressed --> Call Function Addtodebug "AAA"

    ELSE

    --> On gamepad 0 Button A is pressed --> Call Function Addtodebug "BBB"

    We see "AAA" in the debug box as expected. The Else statement works just fine.

    Does this mean all inputs are not considered equal ? How are keyboard inputs different from gamepad ones ?

    A simplified CAPX illustrating this conondrum can be downloaded here : mediafire.com

    Thanks in advance for your help, I lost a few hours isolating this problem and I'm scratching my head as to why it doesn't work <img src="{SMILIES_PATH}/icon_redface.gif" alt=":oops:" title="Embarrassed" />

  • Ok, thanks for your explanation you two

    As long as it's not messing the calculations, it's ok. I'll use the rounding trick if I want a figure to appear in a debug log from now on.

    Cheers and thanks again

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm converting a number into a string, sure, but that doesn't explain why Cos(270°) becomes this weird number when it's not alone. 0 converted into a string should still be "0", right ?

    Cos(270°) should always be strictly equal to zero... unless I don't understand cosinuses well (which is a possibility).

  • What do you mean ?

    I can usually concatenate figures without problem

  • Hi there ! <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" />

    I'm no big connoisseur in trigonometry but I had to dip into it a little in order to generate a laser for my Run N' Gun shooter. I've managed to have my laser working but I've been puzzled by one small inconsistency I can't explain...

    (I've simplified the CapX and you can download it here : mediafire.com

    (to generate a laser you have to hold an arrow or more and use the left click)

    See, I have a debug box. When I add into my debug box Cos(270) it writes 0 as expected. Also Sin(270) writes -1.

    So that's good.

    But when I try to concatenate Cos(270)&" / "&Sin(270) the cosinus is wrong. It gives a figure veeeeery small but not nul. So it writes something like "-1.8369701987210297e-16 // -1" instead of "0 // -1".

    Is it because of the cosinus ?

    Or because of the concatenation ?

    More importantly, can this mess up my computation for the laser's width in any way ? (line 27-28 of the Event Sheet 1)

    Thanks in advance for taking the time to reassure me <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />

    Best regards

  • Damn, I realized I forgot to thank you guys for your answers. Sorry.

    Thanks to your help, I realized the while loop was totally optional in my case.

  • Hello everyone,

    Sorry to dig this old topic, but my question is in the title... and it is unsolved as far as I'm concerned :/

    R0j0's answer may be correct when the condition is related to an object, but what if it is related to a variable ?

    Simple example :

    • we are making a platformer
    • we have two variables, one reflecting the left stick direction (LStick), the other stating if the player is crouched or not (IsCrouching)
    • LStick can be set to "Up", "Down", "DownRight", "DownLeft"
    • we want to set up a loop, instead of three redundant loops, that says :

    while (LStick="Down" OR LStick="DownRight" OR LStick="DownLeft")

    then IsCrouching= "True"

    I've tried the "Pickbycomparison" but variables are not attached to an object so I don't know what to do...

    Many, maaaany thanks in advance for the one who'll be able to answer me =)

    (also, a quick side question : can you add an Else event after a While loop ? So that if the while loop is not working the IsCrouching is set to "False" again )

    Cheers

Sam Dimanche's avatar

Sam Dimanche

Member since 31 Dec, 2016

None one is following Sam Dimanche yet!

Trophy Case

  • 7-Year Club
  • Email Verified

Progress

8/44
How to earn trophies