Disabling Collision

My goal is to have an enemy that takes all types of damage when on land, but normal projectile miss when it’s in the water. I’m not really sure how to make this effect. Since you can’t disable collision, and if I was able to do that, then NOTHING would hit it. Any ideas?

1 Like

If the thing is in water than a switch activates to make it not take damage

2 Likes

The damage works when a projectile hits an enemy, they destroy itself and send a message full of damage. So I have to make it where the bullet never collides with it.

make the boat send a message to last contacted to destroy (which destroys the bullet)

If you want to hit some objects and go through other objects,
you need to make it not solid and make collision parents for what you want it to collide with.

2 Likes

This makes the most sense, but how would I make it swap properties, that’s what i’m looking for. LIKE, if you can hit an enemy when you see them, but they don’t get affected if you can’t see them.

I don’t understand what you mean… you can’t swap properties of an object atm.
If you’re asking about hitting specific enemies, then you would have to tie them together with parents and select the parent as the collision.

edit: Don’t get affected when you can’t see them?
You could try messaging all spawned objects to toggle off enemy collision, maybe?

1 Like

If you’re familiar with Plants Vs Zombies, the snorkle zombie is EXACTLY the thing i’m looking for, when they’re in the water, the peas go above and miss them, but when they pop out, they can get hit by them.

You could try 1 of 2 things that i can think of.

  1. When in water, spawn a zombie for a water and delete the normal zombie. When on land, vice versa.

  2. Try messaging to last contacted enemy and ask them if they are hit and delete the projectile if yes. The problem with this is that it may not work with enemies stacked ontop of each other.

1 Like

From what you’re saying it sounds like all you need is a nonsolid object with collisions enabled, then have a switch turn on/off for it to be damaged. For the projectile to be destroyed/not destroyed depends on if the “zombie” is on land or water. When the enemy takes damage send a message to the last contacted object, so if it’s underwater it won’t take damage because the switch is off, meaning it won’t send a message (could have possible problems with collisions). Now that I typed this out I realized that I basically just said what JR said.

Well to add in something new, depending on how you have this laid out, you could have it so that the pellet no longer has collisions when it hits the water (either with collision or proximity). Both the methods JR said work, but if you can’t do either of them I’ll try to think of an alternative. (Slight note with the spawning method, depending on the number of “zombies” you have this could lower performance.

1 Like

Looked a little bit at your game but not enough to know what I’m doing.
Maybe water attacks can send two messages one being damage the other water damage. When your character goes into water you could turn off the switch which allows it to absorb normal attacks and turn on the switch that lets it take water attacks.

Keep in mind you clearly know more about what your doing than me in flowlab so this advice probably won’t work

1 Like

How did you find my game, I didn’t link it. This game is private, but currently your idea is something i’m toying with.

Isn’t that idea the same things that JR and I said?

I’m going to be honest I didn’t completely understand what you guys were saying xD
I thought you guys were just suggesting using switches I didn’t realise you were also suggesting sending two types of messages

Ahhh I just found a plants vs zombies esque game online.
By any chance do you have multiple PvZ games that your working on

Mine is private, the other PVZ esque game is an old project, to be fair it shares most of the mechanics, and in that game I have an enemy that has exactly what i’m looking for. But since I changed how projectiles work as a whole, it’s no longer viable. I’m out of any ideas at this rate.