Okay, I have a bit of an obscure problem here. I’m trying to make emitted projectiles from my hero character pass through certain blocks in my game, but it’s working only sporadically or not at all. Here’s a screenshot of the problem area:
The greyish-purple blocks in that screenshot are “horizontal colliders” intended to confine the red monster as well as become invisible when the game is run, so that the red monster will always keep running between those two blocks. The colliders are treated as non-solid but still allow collisions (which is necessary since the collider wouldn’t work if they didn’t allow collisions).
However, there’s one problem: when I get my hero character to shoot a flame sprite at the monster but the invisible collider block is in the way, the flame sprite stops dead in its tracks.
You can see that in the screenshot below; the flame sprite is just about to disappear while travelling to the right.
Is there any way I can add an exception to the behaviours of the flame sprite so it passes through collider blocks but not anything else? Here is a screenshot of the behaviours I’ve added to the flame sprite’s behaviour window:
I’m still new to Flowlab and want to know if this will involve me needed to put in a lot of work to make this exception work. My Flowlab game can be found here.
Instead you could make the enemy detect the “Turn-Around Block” (Greenish Purple Block) with Proximity or raycasts and completely remove the ability for anything to collide with the Turn-Around Block.
Here, use this. The objects that it collides with and isn’t destroyed by go into the b
In this case, put the grey-purple collision object(s) into the b input and an any into the a input.
Oh so that’s what XOR is for. Awesome.
That means this should help resolve WYTams problem.
I’m, pretty sure that works, @WYTam.
I thank you for your help, but assuming I followed your instructions correctly, your solution introduced another problem (I suppose I should get used to that when it comes to computer programming). Here’s how I arranged the behaviours of my flame sprite according to your instructions:
Then after some testing I noticed this new problem: The Flame sprite is passing through a Wall Block where one of my greyish-purple “Horizontal Collider” blocks is also positioned.
This is where the “Horizontal Collider” block is placed, underneath the Wall Block that I moved to its immediate left.
Otherwise, your solution works, and while I am grateful for that, I’d like to know if there’s something I should be doing at that particular location so that the red enemy turns around at that location and so the Flame sprite is stopped by the Wall Block where the Wall Block and the Horizontal Collider are at the same location. I’d like to keep using as much the same amount of code (or at least the behaviours I’m familiar with) as possible as well.
Also, is there anything you can help me with regards to this part of the first level in my game where the Flame sprite keeps passing through, even with your new code?
Thanks for looking over this.
If you don’t want the fireball to be able to pass through the stone, then just add a stone collision to the b input.
By “just add a stone collision to the b input,” you mean like this, correct?
I’ve added a Collision behaviour block for the “Wall Block” sprite and connected it to the b input, but the problem still persists, as can be seen here:
In any case, I do not understand the rationale behind adding a third Collision behaviour block (for the “Wall Block” sprite) and tying it to the b input of the Logic Gate block, as LGs are not something I’ve used before, and wouldn’t doing so be redundant given the “Collision - Any” block I’ve already added? According to the Flowlab Behaviours Handbook, an XOR Logic Gate is only active when one single input is active, which should mean that if “any” sprite or the Horizontal Collider block is hit but not both at the same time, the Logic Gate should activate and the Fireball sprite should be destroyed. Or am I getting something wrong here?
Your fix also did not resolve the problem of the Fireball sprite passing through the Wall Blocks at certain places in the first game level, even though those Wall Blocks are not overlaid with anything else, as seen here:
That’s strange, from what I know, it should’ve fixed the problem. I don’t know much about logic gates, so there might be a feature I didn’t know about that is causing this issue. @Flying_Fajita, can you help?
Honestly I would put another invisible block right next to the Wall Block so it acts as the collision block that breaks the fireball. But that would be inefficient. Instead connect the Wall Block hit output to another logic gate that says NOR and connect the output to either A, B or both (it doesn’t matter). Then make it so the output to the NOR gate would turn off a switch connected to the destroyer. I could post a screenshot of this to make it out simple but Flowlab is blocked for me and there’s this strange glitch where if I keep my School Laptop open for long Flowlab will be free for me to use. Sadly, this glitch hasn’t occurred yet today.
The collision ANY should work as the collision WALL BLOCK though… I’m not really sure why. It might be a bug, I’ll have to ask better people to help out and report it. Do this for now, though.
yeah, this also fixes it:
The collision is set to only left right, make sure all of them are enabled.