difference between 2 numbers (not distance)

Get help using Construct 2

Post » Wed Jan 18, 2017 10:26 pm

hi im having trouble finding the logic for finding the difference between to value, anyone able to help??

Thanks
B
14
S
6
G
3
Posts: 83
Reputation: 4,218

Post » Wed Jan 18, 2017 10:47 pm

System >> compare two values then use logical comparison there (equal to, not equal, less than, etc.).
ImageImage
B
101
S
45
G
22
Posts: 772
Reputation: 21,468

Post » Thu Jan 19, 2017 10:43 am

there is no difference option there. ill explain better.

the user collects xp and is stored in xp "xpplayer" variable
is then added to "xptotal" total variable

if the user "xpplayer" variable exceeds the "xptotal" variable then
the player levels up and the "xptotal" variable is reset to 0 and whatever is left from
the xpplayer" variable get added to "xptotal" so they can get xp to level up again

hope this helps
B
14
S
6
G
3
Posts: 83
Reputation: 4,218

Post » Thu Jan 19, 2017 11:32 am

Yes, there is a 'not equal to' option in 'system > condition > Compare two values'. But that is not what you need.


System > Every Tick
Sub EventS ... Local variable 'Exceed' = 0
........................System > Compare two values ... First = Player.xpplayer ... Comparisation = '> is greater then' ... second = xptotal
....................................ActionS: Set 'Exceed' to xptotal - Player.xpplayer
.................................................Set xptotal to zero
.................................................Set Player.xpplayer to 'Exceed'
.................................................Level up
B
33
S
18
G
27
Posts: 2,430
Reputation: 20,324


Return to How do I....?

Who is online

Users browsing this forum: mrkaio, muquia, R0J0hound, tarek2 and 2 guests