Enemy Patrols: Part 1

Get help using Construct 2

Post » Wed Aug 28, 2013 5:56 am

CAPX: https://www.sugarsync.com/pf/D6025908_4317202_6996048

Because my issues are multi-faceted, I've decided to break it up into individual posts, but they're all related.

Here's the rundown on how the Enemy behavior is SUPPOSED to behave:
When the AllEnemies family variable is set to...
1. Normal - The Enemy instances will travel between the PatrolNode object; the directions are determined by the frame number of the object.
2. Chase - When the Player comes into view of the Enemy line of sight, the Enemy will chase the Player until line of sigh is lost.
3. Alert - The Enemy will patrol from within a radius from the last known spot the Player was seen. After so much time has elapsed, the Enemy will return to its original patrol route.
4. Resume - After the Alert phase is over, the Enemy will seek out the PatrolZone it was assigned to at the start of the level, preventing Enemies from congregating in one zone.

PROBLEM 1
I can't get the Enemy to begin its patrols normally.

Initially, I had each PatrolNode spawn its own array. In the array was stored the IIDs of other Nodes that lied in the path if you drew a line from one Node to another. This way I could pick the Node to Pathfind to based on the starting Node's available directions.

Then, I created an image point to act as a "horse following a carrot held on a string". While in Patrol mode, the Enemy will plot a path to its own image point every so many seconds. But at the start of the layout, all Enemy instances start moving forward only to veer off and keep going until they hit a wall...

I finally caved and added the Bullet behavior to the AllEnemies family (I wanted to keep things simple and work with just Pathfinding). Even after ensuring that the speed and acceleration of the Enemies are greater than zero and initially enabled, they do not move.

So I'm really lost as to what I'm doing wrong.Rhindon2013-08-30 05:34:30
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
142
S
24
G
8
Posts: 791
Reputation: 15,148

Post » Fri Aug 30, 2013 1:59 am

*bump*
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
142
S
24
G
8
Posts: 791
Reputation: 15,148

Post » Fri Aug 30, 2013 2:16 am

I can't find the logic for where it changes the PatrolStatus to Patrol? It's Normal by default and I can't see why it would change from that. It changes to Chase fine if you go up close though.

Also I don't understand the reason for the mega complex node system + pathfinding. Can't you just simulate patrolling by having the enemy move from one location to another and if it gets interrupted then change to another status. Or are the nodes important for some other reason?plinkie2013-08-30 02:18:45
B
47
S
17
G
82
Posts: 2,230
Reputation: 48,607

Post » Fri Aug 30, 2013 4:26 am

Ugh, look at my game http://powerupware.com/HitMagicRun/Forest/ There are wolfs are hiding, not patrolling, but they can do such as Alert, Chase and Escape.

Are you looking this method?
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421

Post » Fri Aug 30, 2013 5:27 am

@plinkie - *facepalm* Doh! Sorry for the confusion. "Normal" is the correct status name; not "Patrol". Same difference, though.

Yeah, the reason for the complex Patrol system is because I had one very early system set up where, say if the Enemy overlaps/collides with the NodePatrol object at the south end and I send it west or east, it's at the very bottom edge and may not actually collide with the next Node...literally brushing just by it. I was having trouble with that at the start, thus why I decided to stick with the Pathfinding behavior - to be sure that the Enemy always knows what its goal is and that it gets there.

@Joannesalfa - Thanks for looking, too! I'll check out your stuff and let you know...
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
142
S
24
G
8
Posts: 791
Reputation: 15,148

Post » Fri Aug 30, 2013 5:30 am

@Joannesalfa - That's not too far off from what I'm looking for. I didn't see it while I was running FROM the wolves in your game (LOVE the initial set-up and the graphics!), but the Enemies in my game will eventually return to their original posts after a chase. But I'm still having trouble even getting the Enemies to START a patrol at the start of the game.
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
142
S
24
G
8
Posts: 791
Reputation: 15,148

Post » Fri Aug 30, 2013 3:05 pm

Where is the logic for patrolling? I don't see anything hooked up to the Normal state. Normal state seems a bit bare, it just enables bullet behaviour.
B
47
S
17
G
82
Posts: 2,230
Reputation: 48,607

Post » Fri Aug 30, 2013 10:54 pm

@plinkie - Right. Again, sorry for the confusion. The whole thing has been a mess the more I try different things.

Right now the Normal status is the only status that uses Bullet behavior while I try to work out yet another variation to my system. Just trying to see what will work and what won't.

The logic is that, in Normal status, the Enemy will travel via Bullet behavior between the PatrolNode objects. When it collides/overlaps with a PatrolNode, it'll be instructed on which direction to travel in (depending on the frame of the PatrolNode object, as identified by the colored arrows).

Does that make sense any? Thanks, again, for your time.
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
142
S
24
G
8
Posts: 791
Reputation: 15,148


Return to How do I....?

Who is online

Users browsing this forum: irina and 24 guests