Bitwise operation

Get help using Construct 2

Post » Mon Dec 05, 2011 2:37 pm

...me again....

I am looking for bitwise operations like AND. Right now, I would like to use AND to set flags for puzzle pieces that have been collected.

And idea where I can find this?
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Mon Dec 05, 2011 3:16 pm

I made a plugin last week-end for my own use... Could share it
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Mon Dec 05, 2011 3:21 pm

I could use something like that too, @Yann.

Sharing is caring!
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

Post » Mon Dec 05, 2011 3:22 pm

Bit.zip
At your own risk :D
Last edited by Yann on Sun Sep 14, 2014 10:56 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Mon Dec 05, 2011 3:22 pm

Thanks!


Works great!!Weishaupt2011-12-05 16:20:59
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Mon Dec 05, 2011 3:39 pm

Do you really need bitwise AND for this? How about a bunch of separate boolean instance variables?
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Mon Dec 05, 2011 4:29 pm

Actually it makes things easier. If you have 8 puzzle-pieces you can set them with OR and then check the value of the variable to be equal with 255....
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Tue Dec 06, 2011 12:17 am

Ashley > I actually use bitwise operation to make a kind of tree.
A Parent contain the bits of its child. And leaves are power of two (only one bit set), so to find if an element is in a tree or another, or if an element is an ancestor to another it become really simple.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, luisgmolina, Magistross, nimos100, R0J0hound, Rezzon71, Yahoo [Bot] and 25 guests