Enemy Movement

game link: https://flowlab.io/game/view/1205300

When enemies bounce of each other, it doesn’t really work. I tried looking at the code but idk how to fix it. Be great if you helped thanks.

Flowlab doesn’t like it too well when you have to moving objects with the same collision, usually because 1 collision activates and the other (in the cloned object) doesn’t.

One way to fix this is to use a raycast with an always going into it to scan every frame.
2 raycasts are preferred to get the right and left side (angles set to 0 and 180).
Using a set a raycast just for ‘new type 13’ is good because 12 is just ground/wall.
Also use a switch for a raycast because it can sometimes output twice which would make it turn around twice.

I’ll send an image for what I did, ask anytime if your confused on what I did:
2019.07.23-17.33

Make it a circle instead of a rectangle. Sure, it will mess with the hitbox a little, but it makes your movement better and it should work. Ask @“JR 01” if it doesn’t work.

Also, yes @ShadowAxeKid, making it a circle would help from getting stuck in place on the ground, but can also be harder to land/stand on.

If you need a square hitbox, I made a system for objects that get stuck when walking:
2019.07.23-17.37

  • The filter is set to ‘Not Equal To’
  • The timer is set to 1 with the repeat of 1
  • The Toggle input is coming from the flip behavior (like the post before this ^)

Just a little tip, moving objects that will always be in the air, like if you want to make floating platforms or, in this case, an enemy (that flies), do not require the circle shape to move easier.

hi,

I’m having this trouble with my enemy at the bottom. I want him to go from left to right of the screen whilst firing.

Here is the link to the game… https://flowlab.io/game/view/1222895

Hey @“Jenny Doyle”,

It’s preferred that you make your own discussion for help but this is an easy fix.
The problem is that flip also affects the hitbox and the angle your shooting.
Instead of a Flip, I would use a Toggle Switch to move in reverse.

Example: going 4 will go right and -4 will go left, using a switch to change direction.
2019.08.10-15.10

Thanks i did it eventually. It all works now.

@“Jenny Doyle”, the new problem is that he fires down now when going left.
This fixes that too.