hholmes's Recent Forum Activity

  • You should use instance variables for each zombie. You can set several sets of coordinates to create 'instance unique' pathing. Couple that with instance style behavior modifiers and you can get cool swarm effets. Not everything is fitting in the image but this will give you the clue you need.

    Here is a high level Heuristic:

    • Create 3 sets of XY Coord pairs (Instance variables) for zombies.
    • Create Instance variable for Mode.
    • Check distance to player to toggle mode.
    • If patrol mode Every X amount of second set 3 random locations nearby the and loop through them as goals to create a patrol effect.

    White Larva "Plaguecyst" are using instance specific patrols and distance measuring similar to what you are thinking.

    If you want your random patrol points to be in a circle you can limit their spawn location by using Pi:

    Similar to this:

    x = (cos(step*3.14159*2))*44+ Sprite2.x

    y = (sin(step*3.14159*2))*44 + Sprite2.y

    Thanks for the info - I will try this as well. Much appreciated!

  • It's not as easy as it sounds but you can accomplish this with some tight function work. You replace every x seconds with the timer behaviour on the zombie object so each has their own timer. Whenever a zombie's state changes you run a function with the zombie UID as a parameter. Then when you call the function you use the condition where zombie.UID=function.param(0), that's how you identify the one zombie object. You can then run things like on zombie.timer ended, run function sending through the zombie UID, and check if you want to make it run a random path and start a new timer on that zombie. If zombie is in proximity of the player you can run a function with the UID to stop it from pathing then change its status to chasing and finding a path to the player.

    I'll give this a try - thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm working on a top-down zombie shooter game with the following mechanics:

    • Multiple zombies spawn continuously
    • Zombies will patrol aimlessly until "hunt mode" is triggered
    • "Hunt mode" is triggered A) when the player gets too close to a zombie or B) if a zombie finds the player's trail (which is generated behind the player as they walk in the form of invisible sprites)
    • Once this mode is triggered, the zombies will continuously find a path to the player to chase them down

    All of these mechanics are working properly - but only with one zombie. What I want to accomplish is to have multiple zombies, each one with their own instance of the pathfinding behavior so that each one can chase the player independently. As it is now, once one zombie's "hunt mode" is triggered, they all are - even though "hunt mode" is an instance variable. I've looked through the pathfinding tutorials, done a fair bit of Googling, and tried all kinds of tricks with For Each and Families, but have yet to find anything that works. Any ideas? I've attached my .capx for reference. Link

    Thanks!

hholmes's avatar

hholmes

Member since 22 Oct, 2017

None one is following hholmes yet!

Trophy Case

  • 7-Year Club
  • Email Verified

Progress

8/44
How to earn trophies