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
44
S
24
G
13
Posts: 723
Reputation: 15,105

Post » Mon Dec 05, 2011 3:16 pm

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

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
80
S
18
G
12
Posts: 326
Reputation: 11,986

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
71
S
22
G
14
Posts: 1,494
Reputation: 16,660

Post » Mon Dec 05, 2011 3:22 pm

Thanks!


Works great!!Weishaupt2011-12-05 16:20:59
B
44
S
24
G
13
Posts: 723
Reputation: 15,105

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
414
S
245
G
92
Posts: 25,206
Reputation: 200,353

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
44
S
24
G
13
Posts: 723
Reputation: 15,105

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
71
S
22
G
14
Posts: 1,494
Reputation: 16,660


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests