AI issue

Get help using Construct 2

Post » Fri Apr 26, 2013 2:03 am

I dont know if you can call it AI but I made some very basic random movement for my npc. It's a top down view game, and the npc just moves in any of four directions. Every one second, a variable is chosen from 0-3 and the variable chosen determines the direction the npc goes.

So that's all fine and dandy, but the issue is that every copy of the sprite that has this movement moves the same way, and what I want is for them to all move differently.

Here's my capx file, please try to help.
https://dl.dropboxusercontent.com/u/30826419/AI%20movement%20Problem.capx

WASD to move. I put two test enemies to show the issue I have, when I want them to have different patterns of movement and not share it.
B
11
S
2
Posts: 91
Reputation: 1,017

Post » Fri Apr 26, 2013 2:26 am

Instance variables that can be used to determine which movement type the characters should use may work here. Have your movement logic check the value of that variable before it moves a sprite.
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Fri Apr 26, 2013 2:34 am

@Basilboy

BluePhaze is correct ( of course )

Try this example
B
45
S
15
G
9
Posts: 1,096
Reputation: 11,038

Post » Sat Apr 27, 2013 12:25 am

Thanks! I just didn't know how to use instance variables so I avoided them, but after reviewing a beginner tutorial I finally got it!
B
11
S
2
Posts: 91
Reputation: 1,017


Return to How do I....?

Who is online

Users browsing this forum: Colorfish, MarkThomas and 30 guests