Issues with my enemy following my player

When I have my player go to my monster, the monster just keeps going down and does not react to the player at all. Is there anything I’m doing in the behaviors that are causing this? If so, is there a way to remedy this?
HighPower Game

Welcome @Emy254! Also in your Enemy object. This is the simplest form of player following you can have:

You can remove the PointAt behavior and replace it with expressions and filters to check the Position of the player compared to the Enemy Position. (I usually do this with some filters to check from rotation
0-90, 91-270, 271-360 along with some and blocks, I will give you more on this tomorrow if needed.) you can then flip the sprite using the Flip behavior and adjust the velocity accordingly. I think this about covers it, if you need more help I would be more than happy to explain it better to you! If you need help ping me: @Death68093 also I would recommend some kind of random to change direction of the enemy with the proximity behavior outputs miss to make it just a little better. And finally I would use collisions or something to keep the enemy from sticking to the walls. I know this is a lot especially for a new user so please feel free to ask anything that you may need!

1 Like

I see. I also want the enemy to be stationary until the player comes near it where it will follow and attack the player, do you think your solution addresses that?

1 Like

Yes, it will do that exactly as long as you don’t have something random connecting to the inputs, and just use the player detection part of the code. The code I gave you in the picture does this also, but I don’t know if that’s the functionality that your looking for.

I’m trying to make it so that once the player gets near the monster, it will follow the player and attack them. Your method is not working for me. Are there any other options?

2 Likes

Welcome to the forums! Gimme a sec. I got a code for you

I said welcome as well, but my post got flagged.

2 Likes

(Don’t copy animations)


Cos = Left or Right: Inputs 1, A 0, out = Math.cos(A*(Math.PI/180))

Angle to velocity image


Angle: Inputs and A is the same, out = ((A%360)+360)%360
Cos: Imputs 2, A 0, out = B * Math.cos(A*(Math.PI/180)) (no spaces when typing this down)
Sin: Same as cos, out = B* Math.sin(A*(Math.PI/180)) (again, no spaces)

If you need me to send a game example so you can copy the code instead, tell me

1 Like

give me 1 minute @Emy254 I will give you a better example than @Endermanjeff
An easier one anyway…

Me regretting saying that knowing I have to make all new code…

1 Like

Really, it was there to just copy. Heck, I don’t even understand most of it

2 Likes

Where can I find the rot feature or property for the angle to velocity?

1 Like

The rot feature is actually called “new input” and you’ll find it in the behavior bundles section and the little calculator looking thing is called expression

1 Like

I still don’t see it. I’m using the classroom version of Flowlab since I am in a class doing this project.

Oh. Would it be alright if I sent the link the game I used and you can copy and paste?

1 Like

Ok. Can you screenshot it as well?

1 Like

I’ll send the link since screenshots didn’t work

@emy254
:Chase Example Topdown - Flowlab Game Creator
:Chase Example - Platformer - Flowlab Game Creator
I realized I haven’t asked if it was either top down or platform, so I sent both. You can go to edit, click on the enemy, and copy and paste

It is a top down game. Thanks by the way.

1 Like