How do i make an enemy npc have a fixed path?

Get help using Construct 2

Post » Sun Feb 01, 2015 9:40 pm

Hello there. I am very new to C2 and I need help with my NPCs.

I am currently making a Top Down View game with 4 direction on my characters. I need urgent help with trying to make the NPC follow a fixed path so if anyone knows how to do this, help would be much appreciated?

Also I want the character to animate as it moves in each direction. For instance, when my enemy goes right, the right animation would play to make it look like he walks, and when he goes left again back to the original position the left animation plays. Thank you.

Also if you open my game file you can see i have security cameras but the animation is jumping. How would i make this go smooth from side to side?
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 12
Reputation: 226

Post » Sun Feb 01, 2015 11:54 pm

Security cameras: Animations aren't the best way to go here. Instead, have one frame where your camera is pointing to the right and the origin is in the middle of the camera itself, then use the Sine behavior on that object to alter its angle. There are a lot of settings there where you can change how far it turns, how fast, etc.

Path movement: There are a lot of ways you can do this. One simple way is outlined below:
1. Give the enemy the CustomMovement behavior(remove the pin behavior, too).
2. Have four invisible sprites representing up, down, left, and right.
3. Give the enemy some intial speed through the custom movement.
4. When the enemy collides with one of the direction sprites, adjust his speed to move in the associated direction.
5. Place your direction sprites such that your enemy will essentially "bounce" from one to the next until he finds his way to the original position, at which point he starts all over again.

There are ways to achieve more complex path movements, and ways to do it using fewer direction sprites, but I feel this provides a good visual explanation of one method.
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,106

Post » Tue Feb 03, 2015 12:03 pm

hi, can someone please do the events for me for my npc police enemy cause im finding it impossible. Please!!!
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 12
Reputation: 226

Post » Tue Feb 03, 2015 12:05 pm

I need help with making my enemy police following a simple path going left and right and playing the animations as he goes in this direction. I would need it to loop please. help pleaseeeeeeeeeeeeee guys
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 12
Reputation: 226

Post » Tue Feb 03, 2015 12:13 pm

linkman2004 wrote:Security cameras: Animations aren't the best way to go here. Instead, have one frame where your camera is pointing to the right and the origin is in the middle of the camera itself, then use the Sine behavior on that object to alter its angle. There are a lot of settings there where you can change how far it turns, how fast, etc.

Path movement: There are a lot of ways you can do this. One simple way is outlined below:
1. Give the enemy the CustomMovement behavior(remove the pin behavior, too).
2. Have four invisible sprites representing up, down, left, and right.
3. Give the enemy some intial speed through the custom movement.
4. When the enemy collides with one of the direction sprites, adjust his speed to move in the associated direction.
5. Place your direction sprites such that your enemy will essentially "bounce" from one to the next until he finds his way to the original position, at which point he starts all over again.

There are ways to achieve more complex path movements, and ways to do it using fewer direction sprites, but I feel this provides a good visual explanation of one method.


Thanks for the feedback but im still confused. Im new to this program. Could you please be more specific or even do it for me?
B
4
Posts: 12
Reputation: 226

Post » Tue Feb 03, 2015 12:19 pm

I added bullet behaviour & disable sine behaviour
You do not have the required permissions to view the files attached to this post.
ImageImage
B
102
S
45
G
22
Posts: 772
Reputation: 21,493

Post » Tue Feb 03, 2015 4:38 pm

Hey!

I added a sprite (policeGuide) which has a variable (direction) just position then at places you need the cop to turn and set the variable to the direction towards which he should turn. I positioned some of them at the intersections, so the cop is already making a circuit if you check it, but you may remove them and program your own circuit. :) Note the guides are transparent, though.

Kleptomania.capx
You do not have the required permissions to view the files attached to this post.
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
15
S
3
G
1
Posts: 329
Reputation: 2,012

Post » Tue Feb 03, 2015 5:39 pm

brunopalermo wrote:Hey!

I added a sprite (policeGuide) which has a variable (direction) just position then at places you need the cop to turn and set the variable to the direction towards which he should turn. I positioned some of them at the intersections, so the cop is already making a circuit if you check it, but you may remove them and program your own circuit. :) Note the guides are transparent, though.

Kleptomania.capx


Thank you so much!
B
4
Posts: 12
Reputation: 226

Post » Tue Feb 03, 2015 5:56 pm

brunopalermo wrote:Hey!

I added a sprite (policeGuide) which has a variable (direction) just position then at places you need the cop to turn and set the variable to the direction towards which he should turn. I positioned some of them at the intersections, so the cop is already making a circuit if you check it, but you may remove them and program your own circuit. :) Note the guides are transparent, though.

Kleptomania.capx


How do i make more police in the game quickly?
B
4
Posts: 12
Reputation: 226

Post » Tue Feb 03, 2015 5:59 pm

Just add them multiple times. Not sure what you meant...
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
15
S
3
G
1
Posts: 329
Reputation: 2,012

Next

Return to How do I....?

Who is online

Users browsing this forum: David181 and 14 guests