Help with NPC for sniping game. Part 1


#1

So I’m working on another project about being a sniper, killing both good people and bad people. So how do I make the good people scared after one is killed and starting running all over the place?


#2

hi try to add an object variable like panic_now to the people put people into two groups GoodPeopleGroup, BadPeopleGroup so then you can control every instance in the group with a foreach and check if their variable panic_now is true or false and act in kind.

ForEach Goodpeople
– if panic_now = true
----- Run like hell

ForEach Badpeople
– ForEach Goodpeople
---- if panic_now true
---------- Laugh of them


#3

Then, how do I make them move to random direction after they’re panicked?


#4

Add a pathfinding behavior(if topdown) and make a sprite called a destination on the opposite side of Player. And set its destination to sprite destination


#5

Ehh, somehow I still can’t make it work. Can you help me a little more?


#6

the distance between good_people and sniper = random px
button shoot is pressed
panic_now = true

ForEach Goodpeople
– if panic_now = true
----- Run like hell


#7

It worked! Thanks a lot!