im trying to make a fighting game, and in the game player 1 will punch player 2. but player 2 can use a block to protect. im having trouble making the block come into affect. and also the xor gate isnt working for some reason
I really suggest to never use mailboxes and logic gates together, it usually just won’t work.
Logic gates require a precise timing with the programming, that even bending a wire back to the behavior can make it not work (I suggest avoiding logic gates if possible).
This is for an XOR gate, right? I suggest using a switch to activate and use a timer to turn it back on, this is what I do for invincibility frames. Set the timer to how long you want the switch off, I suggest using 1 in the timer if you want it to work like the logic gate.
Bundle for AND gate replacement
Switches can usually do the job well; but if you need 2 things to activate, I have a bundle for that.
{"data":{"behavior":{"v":"2","nodes":[{"inputCount":2,"outputCount":1,"name":"Input Gate","behaviorType":"logic.NodeGroup","x":990,"y":128,"id":"6c5a33d4291e3844","isMenuItem":false},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":900,"y":608,"group":"6c5a33d4291e3844","id":"6c5a33d4f8ba4a4a","_startVal":0,"dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":720,"y":608,"group":"6c5a33d4291e3844","id":"6c5a33d4825bb44e","portId":"6c5a33d4291e3844i0","tag":"A","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":720,"y":672,"group":"6c5a33d4291e3844","id":"6c5a33d4cae5794f","portId":"6c5a33d4291e3844i1","tag":"B","dataType":2},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":1080,"y":608,"group":"6c5a33d4291e3844","id":"6c5a33d42d433749","_startVal":0,"dataType":2},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":1260,"y":608,"group":"6c5a33d4291e3844","id":"6c5a33d43aa35b4b","portId":"6c5a33d4291e3844o0","tag":"out","dataType":2}],"links":[{"input_id":"6c5a33d42d433749i2","output_id":"6c5a33d4f8ba4a4ao0"},{"input_id":"6c5a33d4f8ba4a4ai1","output_id":"6c5a33d4825bb44eo0"},{"input_id":"6c5a33d4f8ba4a4ai2","output_id":"6c5a33d4825bb44eo0"},{"input_id":"6c5a33d42d433749i1","output_id":"6c5a33d4cae5794fo0"},{"input_id":"6c5a33d4f8ba4a4ai2","output_id":"6c5a33d4cae5794fo0"},{"input_id":"6c5a33d42d433749i0","output_id":"6c5a33d42d433749o0"},{"input_id":"6c5a33d4f8ba4a4ai0","output_id":"6c5a33d42d433749o0"},{"input_id":"6c5a33d43aa35b4bi0","output_id":"6c5a33d42d433749o0"}]}}}
This code will wait until both signals have entered and reset after output. Very useful for many Logic Gate scenarios or just needing to sync up the code from 2 signals. Just paste this code in the import selection to get the bundle.
could you show me an example of it being used, im relativly new to flowlab and i dont really know how everything works yet
I just updated the post above for an XOR gate with an image, that bundle (that is now a tab at the bottom of my comment) is best to replace AND gates.
its still not working, but i dont think an xor gate would have worked anyway. i want the block to stop send the punch signal. but i dont want the block to activate any signal on its own
The switch has to be ON to work, also try setting the timer to 5 instead.
how can I modify this so that the block wont activate the system at all but instead shut it off while the punch will continue to activate the system
I think I see what you are asking for, the best solution is to send a message of 1 (Blocking) and 2 (Not blocking) from the “block” mailbox. That will tell the switch to turn on and off to allow punch.
i tried it out and it works, Thank you!