Heroes4hire's Recent Forum Activity

  • And they ignored other enemy base. They will path through other enemy base. Even though they should stop whenever they are within 40

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah. Litterally that.

    For each base pick nearest enemy base.

    All the base just path to the same enemybase, ignoring other closer instances

  • Well I'm in a process of testing. 1v1, no problem. 2v1. Got it down. But I went into 2v2 3v3 ect and problems with pathing arise.

    I'll look for examples. But, like i say, 5v1 no problem. Maybe theres a comand and conquer style game I can look for.

    On start of layout

    For each playerbase

    Find nearest enemybase. Find path

    For each player base

    distance to enemy base <= 40. Stop trigger battle boolean.

    For each player base, pick nearest enemybase. Distance >= set boolean false

    For each player base, boolean is false. Pick nearest enemy base. Set path to enemy base.

    Basicly what I'm running with.

  • Think I mis understood.

    termanolagy I'm not 100% on

    You want the white puck to not overlap while choosing a place to use it from?

    So instead of going red, you want it to lock to the nearest available position? Until the mouse has taken it past a point.

    Say the blocking piece is 50 wide.

    On colision set the piece to have a boolean.

    When boolean is checked.

    While

    Boolean is true

    mouse x is between piece.x-25 and piece.x

    Set puck.x to piece x-50

    While

    Boolean is true

    mouse x is between piece x+25 and piece.x.

    Set puck to piece x+50

    I turned off the computer, cant test it untill tomorrow.

    But, that should activate a piece on contact. And set the puck location to next to the piece right or left, depending on the mouse location.

    Just have to turn off boolean when mouse goes past

    This will lead to more issues if 2 pieces are next to each other. I'll work on it tomorrow if that's what you need.

  • Looks beautiful!

    Save the puck x and y on a global variable.

    Then you can test if its overlapping when choosing a space.

    When puck stops. Save its x and y.

    Then set its location to the global variable x + its width.

    If its overlapping something, use the global variables to reset its position.

    Give it a variable count on fail.

    Then say if variable =1

    Reset position to global xy

    Move puckx to puck x - its width.

    You can then do this to its y axis. If it overlaps again

    This is.. 4 directional... 8 is you make more clauses

    Hope this helps. Hope I understood what you wanted

  • I'm using "for each" playerbase.

    Is there a better way to identify who is forfilling the clause?

  • 2 players same base difforent variable. 2 enemies, same base difforent variable.

    I want each player to pick the closest enemy. Then move towards them. I'm using pathfinding.

    I've tried pick nearest. But when using multiple instances they target the same entity.

    And then.

    When distance <= 40 stop, trigger battle boolean.

    But only one instant will stop. The other will pass get closer/ pass through its target.

  • Wow. Hierarchy is powerful. Had no idea. So simple! Thanks for the shout this will make everything easy

  • Ah. Yeah. So. I have bodies linking to bases.

    But, I have several sets of bases. All spawning in their own torso.

    Will I need to make several bodies to corilate to their own group?

    Guess I'll find out soon enough

  • Wow! Yup, I'm a construct 2 guy. Just working from what I remember.

    I'll try hierarchy or containers. Construct 2 had families. I toyed with the idea, but couldnt find it..

    So just tried brute forcing it.

    Lionz, no it's a variable called bodycount. Was just trying to simplify it for the example.

    Thanks for advice guys. Apprieciated

  • So. I have player base(s)

    I have bodies.

    Each base spawns and pins a body. And gives it the same variable to group them. count.

    I want the base to tell the body its angle every tick. In a variable .deg.

    I've tried

    for each torso, base.count=torso.count

    Set torso.deg to base.deg.

    But this only seems to affect one instant of the torso, or it affects them all.

    Is there a better function to do this? Like for each instance.

    Or, a better way to check sprites individually?

    Or should I group them into families?

    I can post a demo if needed

  • Got it.

    For each enemy base.

    Player base, pick nearest enemybase.x/y

Heroes4hire's avatar

Heroes4hire

Member since 19 Mar, 2024

None one is following Heroes4hire yet!

Trophy Case

  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

5/44
How to earn trophies