Waypoints

0 favourites
  • 10 posts
  • 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. :)

    dl.dropbox.com/u/10370146/td1.capx

  • "Soldier , We have some creeps sneaking on us , Deploy the turrets ! "

    "Rogers , Sir" 3-2-1 *Kaboom*

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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)

  • Thank you so much!

  • 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. )

  • 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

  • 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...

  • 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.

  • 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 )

  • Whiteclaws Turns out my issue was from using is overlapping instead of using on collision. Much better now!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)