# How do I - Math - How does int() work?

0 Favourites
• 5 posts
• I'm using an event - in this event, I have [System - pick sprite where sprite.X DOES NOT EQUAL int(1-5) Would int(1-5), is this actually 1 minus 5? or is this pick 1 through 5? What I WANTED to accomplish was, I wanted the system to pick every sprite that DID NOT HAVE these specific values. Is this possible? For example, if the sprite.HP is NOT 1,2,3,4,5, I would like the system to select those sprites. I read the manual on the math expressions but I think I would understand it better if I had someone really dumb it down for me. Thanks for the help.

• The int() expression turns a float (number with decimals) to a whole number, rounded down to the next lowest whole number. So, int(1-5) is the same as int(-4) which equals: -5. Probably not what you were hoping for... The c2 event system is incredibly powerful and will filter/pick all instances that satisfy a condition or conditions that you define.

So, for your example, are the sprite.HP values all integers (ie whole numbers)? If so, you could use this OR condition to pick all of the relevant sprites:

Sprite.HP > 5

or

Sprite.HP < 1

• Thank you for your help Colludium, that really clears some things up for me.

But now I have another question. - Where do I input the OR condition?

do I type it in as a string? Is it somewhere under the system conditions? I tried typing it in in the "Value" box,

I wondered if it was an event such as "else" ? - Ah wait, did you mean an "OR block"?

Ahh I see I understand clearly now.

For everyone else looking for it - https://www.scirra.com/manual/75/how-events-work

Thank you very much Colludium, wish I could +1 you or something.

• ## Try Construct 3

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

Construct 3 users don't see these ads
• Select your event (not on top, on left side) right click and choose Make 'Or' block

• Select your event (not on top, on left side) right click and choose Make 'Or' block

Yeah, this definitely is something I wish I knew when I started using C2.

Clicking the far left has a difference than clicking slightly to the right of the far left.

Learning that has definitely improved my workflow.