How do i do this thing ig

so I’m making a enemy that stands in one spot. but once you come near it. the thing charges at the player. so I don’t really know how to approach it or know how to do it.

There are multiple ways of doing it depending on whether moving left or right, or in all directions, and whether moving linearly, or fluidly.

Here is an example of moving fluidly in all directions:

(in this case, NewSprite5 was my enemy character, and NewSprite2 was my main character)

Edit: While it won’t make a difference to the result, another, more advanced thing I might recommend is to do a check whether the enemy is operating with a force first, and if it’s not - follow the character. Because the Permanent Force only needs to be applied once and not every frame.

1 Like

why 1 pixel do you have any idea how slow that will be

1 Like

It’s true that 1 pixel can be a little slow, @Phoenix . You can always try 2 or 3 pixels instead of 1.

When you have fluid, all-direction movement though, it’d be difficult for the main character to get away if you make it too fast.

This does lead to a question though… is the code, as I have it, operating independently of framerate?

I’ll have to do more research now :slight_smile: