enemy AI, distance calculation

This forum is currently in read-only mode.
From the Asset Store
Enemy turtles pack including fifteen fully animated variations
  • Man... stuck again.

    I'm trying to trigger an event with

    distance(herosprite.x,herosprite.y,enemy.x,enemy.y)lower or equal to 300

    Nothings happening. The only thing I can think of is that "herosprite" is a global sprite located on another layout, and I'm not clear yet how different instances of an object effect things...

    Anyway, here is the CAP, I'm too tired to think about it anymore... Hope you guys can help!

    CAP

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Make the objects herosprite and hero non-global, and copy>paste them in the other layout. That worked for me.

  • I see nothing happening because must use a 'for each Sprite37' in the ES of layout4, event 5. This due to, there is more than one instance of sprite 37 and the event picks all at once, and you must check up one by one.

    Try that above or try adding before checking condition a 'pick closest to herosprite', 'enemy' sprite condition, this should work properly.

    EDIT: this i speak about:

    + Sprite37: Pick closest to: compactorhero.X, compactorhero.Y

    + System: distance(compactorhero.X,compactorhero.Y,Sprite37.X,Sprite37.Y) Lower or equal 300

    -> Sprite37: Set 'aggro' to "yes"

    or

    + System: For each Sprite37

    + System: distance(compactorhero.X,compactorhero.Y,Sprite37.X,Sprite37.Y) Lower or equal 300

    -> Sprite37: Set 'aggro' to "yes"

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