&, &!, &=

Talk about anything Fraxy-related here. If you need help with Fraxy or the forums, you can ask here.
Post Reply
User avatar
Concept
Fraxy Beginner
Fraxy Beginner
Posts: 24
Joined: Thu Jan 12, 2012 12:43 am
Epicness: Video games

&, &!, &=

Post by Concept »

I was having some trouble figuring out what these did and after some detective work and help from FF I solved them. I was requested to make this thread explaining them so here it is:

& checks the first variable's bit values against the second variable's bit values
In the editor hit up the misc button and head over to the calc tab, there is a bit calculation page there. Here you can combine various powers of 2 to create numbers. Basically what & does is, check to see if any of the powers of 2 that make up the first variable also exist in the second variable.
The number 100 for example is made up of 4, 32, and 64
The number 12 is made up of 8 and 4
If you do 100 & 12, you'll get true because there is a 4 in both of them

&! does the opposite of &

&= does something very similar, except it checks to see if ALL the powers of 2 that make up that number are also in the other number so for example 100 &= 12 would be false because 8 isn't in 100 but 100&=36 would be true because 36 is 4 and 32, both of which are in 100.

This is actually pretty exciting stuff, here is why: due to the way it works, you can now reuse the same variable for many things, for example say you had a variable that checked to see if part A was destroyed and a variable that changed when Part B was destroyed. So say you have the following events:
Event 1:
Condition: Part A destroyed
Action: Variable 1 + 2
Event 2:
Condition: Part A destroyed
Action: Variable 1 + 4

Using the same variable you can check for all 4 states:
1.) Part a destroyed and part b destroyed (Variable 1 &= 6)
2.) Part a destroyed and part b alive (Variable 1 & 2)
3.) Part b destroyed and part a alive (Variable 1 & 4)
4.) Part a alive and part b alive (Variable 1 = 0 ) 8D
Also SECRET BONUS state:
X.) Part a OR part b dead (Variable 1 & 6)


There are a lot of other applications too but those are up to you to discover ( I AM TOO LAZY TO KEEP WRITING).

User avatar
Kamui OS
Fraxy Beginner
Fraxy Beginner
Posts: 39
Joined: Tue Jan 19, 2010 12:14 am
Location: Elsewhere, USA
Contact:

Re: &, &!, &=

Post by Kamui OS »

Hmmm..... so the matter is much more complex than I had originally thought...

http://wiki.fraxy.net/index.php?title=T ... ify_Status" onclick="window.open(this.href);return false;
We, the unwilling, led by the unknowing, are doing the impossible for the ungrateful. We have done so much, for so long, with so little, we are now qualified to do anything with nothing. - Unknown

Support these sites!
Here...
Redux Wiki
Fraxy Academy
Fraxy Facebook Group
Fraxy YouTube Group
Shoot Em Up Wiki
Gradius Homeworld

IRC:
UFF - irc.us.mibbit.net #Fraxyuff
Redux - nucleus.kafuka.org or kuroi.irc.djbouche.net #fraxy

Best Fortune From Cookie: "Made In The USA"

Post Reply
Users browsing this forum: No registered users and 47 guests