Negative value, positive value

This forum is currently in read-only mode.
From the Asset Store
809 energetic male voice announcer phrases for casual & mobile games, such as puzzles, match, quest, casino, sports etc.
  • I want to do it:

    I have a private variable called HorizontalVelocity and it is equal to 6

    I want to change the positive value into negative, or if it was negative (Iqual to -6), convart it into positive.

    Using a standard programming language like C/C++, it would be: HorizontalVelocity=-HorizontalVelocity, but I don't know what do I have to write it in Construct (The private variable belongs to a sprite called "Ball"). The action would be "Set value to a private variable", but I don't know what do I have to write in the expression field (It should be an equivalent for HorizontalVelocity=-HorizontalVelocity; in C/C++)

    Please, I'll be waiting for your help.

    Where is Scirra from?. Is Scirra from the United States of America?. I could imagine that Construct is in American English because (Behavior, for example). British English: Behaviour.

    Bye'!!!

    Nicol�s Mat�as Funtalas from Buenos Aires, Argentina

  • i don't have access to construct right now but there should be an "absolute" method which forces values to be positive

    abs(value)

    absolute(value)

    or you can even try the "vertical bar" key (it's to the right of the square/curly brackets)

    |value|

  • Set velocity to (0 - velocity)

  • Set velocity to velocity * -1

  • Set velocity to (0 - velocity)

    Set velocity to velocity * -1

    Either way (they both do the same thing )

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • -1*HorizontalVelocity

    You could also do angle = angle+180, depending on how you're doing your motion.

    Scirra is great and the community is really helpful and nice. Welcome!

  • We're from the UK by the way, not sure why we didn't use '-our'.

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