Mudulo and remainder arren't excactly the same thing...

Discussion and feedback on Construct 2

Post » Tue Jul 22, 2014 6:52 pm

The modulo operation should always return positive values:
mod(-1, 8) = 7
mod(-9, 8) = 6

While the remainder operation can return negative values:
-1%8 = -1
-9%8 = -1

Construct and it's documentation seems to treat both as the same thing, and only provides us with the remainder operation, unless I'm missing something... Would be cool to see the actual modulo operation in a future version.~

Oh and for a workaround, in able to "convert" the existing remainder operation to a modulo operation you can use this expression:
Code: Select all
(a%b + b) % b

This will return mod(a, b), always an integer between 0 and b-1.
B
8
S
1
Posts: 53
Reputation: 787

Post » Tue Jul 22, 2014 9:09 pm

I thought modulo for negative values was not properly defined consistently as an operation
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 2 guests