NPC movements

Get help using Construct 2

Post » Sun Sep 18, 2016 3:00 pm

Hello everyone,
I am making a RPG and you all know how important NPCs are and NPC movement are also very important my problem is how I move NPC to a certain position and then come back to its original position and then go back to that certain position and this process go on forever but when player collides with NPC the NPC stops and after talking to player it continues its walking pattern.
Please can anyone help.Thanks..
B
9
S
4
G
1
Posts: 89
Reputation: 1,498

Post » Sun Sep 18, 2016 7:27 pm

Couple of ways, easiest is path finding.
Give the npc 4 variables, 2 are its initial position. And for each npc on start of layout set these to its current coords.

The easiest way to find the coords it wants to go to, are place it there, and copy it's numbers.

However, an alternative method would be to have lots of tiny sprites littered around with a variable that relates to the npc who is walking between them. On start of layout, for each npc, pick the nearest sprite with the same variable number. Find path.
Then npc on arrived, pick furthest sprite with the same var no.

This method is good as it's like 2 lines of code for all npcs. All they need is corisdonding variables. Good luck.
(Note* you can have pick random sprite for a more sporadic movement)
B
9
S
3
Posts: 102
Reputation: 987

Post » Mon Sep 19, 2016 4:50 am

@Aher0 thanks I'll try that.
B
9
S
4
G
1
Posts: 89
Reputation: 1,498


Return to How do I....?

Who is online

Users browsing this forum: jorgmaquoi, SignalOne and 18 guests