line of sight platform

Get help using Construct 2

Post » Sat May 03, 2014 7:45 am

so im trying to make the enemy follow me and all, but he gets out of the path, i want him to to only walk left and right, how can i do this?

https://dl.dropboxusercontent.com/u/597 ... a%202.capx
B
5
S
1
Posts: 77
Reputation: 754

Post » Sat May 03, 2014 9:50 am

maybe this fixes your problem?
You do not have the required permissions to view the files attached to this post.
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

Post » Sat May 03, 2014 9:07 pm

Roccinio wrote:maybe this fixes your problem?

yes its a lot simpler, the only problem i see is, when i dont move the enemy shakes, instead of staying still, any advice?
B
5
S
1
Posts: 77
Reputation: 754

Post » Sat May 03, 2014 9:59 pm

kionysan wrote:
Roccinio wrote:maybe this fixes your problem?

yes its a lot simpler, the only problem i see is, when i dont move the enemy shakes, instead of staying still, any advice?


use the platform behaviour and do this

if player.x is greater (>) than enemy.x then -> simmulate control pressing right

if player.x is lesser (<) than enemy.x then -> simmulate control pressing left

to eliminate any kind of odd behaviour like the enemy geting to the same X as player and starting to freak out you should do this

if player.x is greater (>) than enemy.x +20 then -> simmulate control pressing right

if player.x is lesser (<) than enemy.x -20 then -> simmulate control pressing left

im not sure about the +20 and -20 if it looks odd switch them around...
B
23
S
6
G
3
Posts: 316
Reputation: 3,461

Post » Sat May 03, 2014 11:24 pm

if enemy overlaping player then set enemy platform behavior inactive
is not overlaping then set platform behavior active
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

Post » Sun May 04, 2014 5:26 pm

Roccinio wrote:if enemy overlaping player then set enemy platform behavior inactive
is not overlaping then set platform behavior active

nice and easy, thanks a lot :D
B
5
S
1
Posts: 77
Reputation: 754

Post » Sun May 04, 2014 6:34 pm

happy to help.
just remember to keep it simple!
B
15
S
6
G
4
Posts: 277
Reputation: 3,948


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 17 guests