Waypoints

Get help using Construct 2

Post » Sat Dec 29, 2012 5:32 pm

So I'm making a tower defense game, already figured out using invisible waypoints to set my creep's path and whatnot. My issue is testing for if the enemy is fully overlapping the waypoint causes enemies to fly off in weird directions if two different enemies hit two different waypoints at the same time.
I'm sure there's some super simple solution I'm just not thinking of, for some reason. Any help would be awesome, thanks!
I've only been using C2 for a few days, so forgive me if it's terrible, this is part of my learning experience. :)
http://dl.dropbox.com/u/10370146/td1.capx
B
4
Posts: 3
Reputation: 406

Post » Sat Dec 29, 2012 6:00 pm

"Soldier , We have some creeps sneaking on us , Deploy the turrets ! "
"Rogers , Sir" 3-2-1 *Kaboom*
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Sat Dec 29, 2012 6:12 pm

Hmm, looks like it doesn't handle well with several overlaps at the same time. You can work around it with a "For each" loop and a boolean: (Or just use Whiteclaws' solution)

BetterWaypoints.capx (r144)
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sat Dec 29, 2012 6:35 pm

Thank you so much!
B
4
Posts: 3
Reputation: 406

Post » Sat Dec 29, 2012 8:58 pm

I just wanted to note that after looking at these solutions ( which do work well ) I ended up going with using just an on collision call and using a system wait for the mob to be completely over the waypoint before triggering the direction change since on collision doesn't seem to go all weird if there are multiple calls all over the place. ( The original drop-box link is the newest version. )
B
4
Posts: 3
Reputation: 406

Post » Sun Apr 14, 2013 6:33 am

@Nimtrix - Really like your solution - but can I ask a followup? Anyone have any theories on you might make a sprite who's rounding the waypoints sensitive to the presence of a player - and respond? I'm thinking there's a patrolling guard moving between waypoints, who, either by line of sight, or proximity is alerted to the presence of the player and respond by moving toward.

Then resuming the routine of rounding waypoints should nothing be found. It's doing my head in - there are many nice solutions in C2, but can't figure how to blend that waypoint-ing behaviour with a player detection/chase mechanism.

Any thoughts would be most welcome...
Cheers
B
7
S
1
G
3
Posts: 7
Reputation: 3,035

Post » Sun Apr 14, 2013 8:25 am

@ADenton I would store the last known waypoint in an instance variable. That way you can put an event that makes the enemy chase the player or attack if they get into a certain distance, then if they no longer see the player, they can use the value in the variable to remember which waypoint they need to head to...
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Sun Apr 14, 2013 8:28 am

@Whiteclaws any chance you have a copy of that capx around still? I get a 404 from DropBox on your link. Looking to resolve some waypoint oddities myself and think your solution may give me some new insight.
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Sun Apr 14, 2013 2:02 pm

@BluePhaze
oh , yes , need to find it tho :P ... Gah , too much capx's :D !

Anyways , what is your problem ?

I'll see if I can find it in the near future ( I hope I do )
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Sun Apr 14, 2013 10:57 pm

@Whiteclaws Turns out my issue was from using is overlapping instead of using on collision. Much better now!
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Next

Return to How do I....?

Who is online

Users browsing this forum: mjj1990 and 7 guests