What are all the things you can do with an expression?

@JR01 I’ve seen in quite a few of your expressions you’ll have something like this “>0”, “%100” or something like that.

So I was wondering what are all the things you can do in an expression and what do they all do? If you want you could just link a document that has the format for this and I’ll read through it

3 Likes

There’s probably around 100 of these expressions.

Here’s the ones I use the most:

Math.ceil rounds up
Math.floor rounds down

You know trig, you know these:
Math.cos, sin, tan
Math.acos, asin, atan

% is remainder

<0 is basically a filter
For example A % 2 == 0 ? 1:0 checks for even because
If remainder A%2 equals 0 output 1, otherwise output 0.

5 Likes

I have most of them marked down in my bundle library under expressions.
But also I get most of my formulas from the Math Haxe documentation.

Flowlab Game Creator - Old Bundle Library
Math - Haxe 4.2.1 API

There are many expressions and types that you can use for what you need. It’s a bit of a mix of coding and math, actually. Most expressions I do come down to formulas, but the most helpful tool I’ve used are if statements to separate answers depending on the inputs.
If statements are Number > Number ? True : False

The “%” is actually a math sign in coding called “Modulo” or the “Remainder” sign.
It takes a value, divides it, and spits out the remainder.
For example: 43 % 10 = 3 or 43 / 10 = 4 with a remainder of 3.
Another example is A % 2 will spit out if it’s even or odd.

The only bad thing about Modulo is that if the value is equal on both sides, Modulo will spit out 0.
So 15 % 5 = 0 instead of 5. So what I do is ((5-1) % 5) +1 to get the better value.

But overall, my greatest achievement with expressions is writing over 150 lines of Haxe code for the ease bundle example, somewhat shown here.

New Ease Bundle! - JR 01 - #11 by JR01

7 Likes