C-7 wrote:I actually do something similar for touch controls using 8 direction. Same principle.
Pick a threshold (it will be an imaginary bounding box) for how close the enemies can get to the player. Say, if they get within 40 pixels of the player, they stop progressing. Otherwise, they keep moving.
This is simple to set up. In this case, we decided threshold = 40.
If player.X>enemy.X+threshold, simulate control "move right" for enemy.
If player.X< enemy.X-threshold, simulate control "move left" for enemy.
If player.Y>enemy.Y+threshold, simulate control "move down" for enemy.
If player.Y<enemy.Y-threshold, simulate control "move up" for enemy.
It will then move up, down, left, right, and any combination of those directions until it is within your threshold (40 pixels here). That way, they won't bunch up and overlap the player. You can have whatever offset you want.
Unnatural20 wrote:I will note that if your enemies should never stop moving, bullet behavior may be more efficient.
Though you can combine that with Turret...
Here, I made a .capx!
FroddeB wrote:C-7 wrote:blah blah
This seems like exactly what I need! Though how does the player.X>enemy.X+threshold work in event sheet? (Sorry if I am being tedious I am just trying to learn new things in construct 2 which could hopefully help me later.)
FroddeB wrote:So at the moment I have the enemy events set up correctly to make the player loose health. Though I was wondering how I would make the enemies move towards the player using 8Direction movement?
Would I set actions "angle toward (player.x, player.y)" and "Set 8Direction speed to 80" to an "enemy is on layer 1" event? I tried this, it did work although every time I was going towards the enemies they were going backwards and sliding across the level but always looking at the player (Or more specific they were sliding the direction I was walking). I have the settings setup so the screen follows the player. Thank you!