I can’t seem to figure out how to fly, or make flying enemies. I’m reduced to constant impulse when a certain distance from the ground. Got any ideas? Cause in a few levels, I’m gonna want to add swimming too. Thanks in advance
There are two basic approaches you can take:
- make the object movable (it will be affected by all physics forces), but lock the “y” property. I have an example here.
I basically just extract the initial “y” property once, then always set the y property back to that same value every frame. This way, the object stays at the height you put it, but can still be affected by forces.
- You can make the object not movable (will not be affected by any forces). Then you can just set the position manually to move it around the screen if needed.
So I can make Y locked until in range of player, then drop. Alright cool. What about following the player? I’m not sure how to use point at if that is it.
I put together a quick example of a chasing enemy here