How to enemy following player
I have a sprite that does that in one of my games. Here’s how I made it work…
I used a timer so that the enemy checks for the player’s position intermittently, instead of constantly. I think an “always” trigger should make it work constantly. I used the timer because I wanted to give my player character more time to escape.
Connect those to extractors (found in the properties menu) - one for both X and Y, if you want the enemy to follow you both side to side as well as up and down. Set both extractors to extract from the other object, then select your player character as the object.
What this does is tells the enemy to extract your player’s coordinates on the map.
Then you will want to connect a “point at” command (found in the components menu). Connect the “other X” to the x input on the PointAt, and the “other Y” to the y input on the PointAt. This tells the enemy to “go to” that location. Set a velocity for the enemy, and then it will move at that speed towards your player.
Hope that helps.
Thank all, And TGW can you screenshot how to spawn monster eggs with 1 level in behavior
Do you mean in only one level?
yes mellojello … t
You can adjust the filter to match the level number of the level and you can adjust the length of the timer but this should work
This basically checks the number of the level that is currently being played. If it matches, then it starts the timer, which will always repeat. Every time this timer ends, the egg will be spawned. If you don’t want a timer, you can just have the filter spawn the egg directly
you are very helpful, And sorry if I ask too much, I’m still a beginner
That’s fine, people on this forum will always be here to help
Hei TGW I I tried what you screenshot didn’t work
and mellojello but not work to
Do you have a link to your game, or a screenshot of your behaviors? There could be something else interfering with your enemy’s movements.
and that how its
It looks like you have your enemy set to rotate, which for a 2D platformer, you probably don’t want rotation unless your character is a ball. Your character should only need X axis movements, and toggle flip when hitting a wall. You probably don’t need the Y axis at all.
so what should i do
Give me a minute, I’m working on an example that should do what you’re trying to do (hopefully).
Actually, cancel that. It’s hard to get it to work right in a 2D platformer using my method. But I did find this instead.
NOT MY WORK. It was created by one of the most talented Flowlab users, @JR_01 so you know it’s good (it works really well, should be perfect for your game). All credit goes to JR. I only get credit for finding the link.
I also have this example where you put the picture of the monster on top of the rotating object that’s chasing the player (that’s invisible). Flowlab Game Creator - Chase Example
I plan to remake this example later, but this and the follow example TGW showed are some ideas to use. What exactly are you trying to do? More details on what you want to do would help.