How do I check if two instances of a sprite is connected to a line?

0 favourites
  • 6 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • Hello!

    I'm having quite some trouble getting something to work. Maybe some of you can give me some ideas how to achieve this.

    In this example if I click on sprite number 1, how do I check if it is directly connected through a dotted line with sprite number 5. In this case it isn't so I would like to set variable "checkConnection" to 'false'. I can't get this to work somehow.

    Thanks for your time guys!

    Kraudi

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You already got the logic that stated each line connected to only 2 nodes. Work from there we can perform flood fill operation to find '5' through the network and Mark the path.

  • You already got the logic that stated each line connected to only 2 nodes. Work from there we can perform flood fill operation to find '5' through the network and Mark the path.

    I forgot to say theres no logic behind the connection right now. I just put a dotted line there for visual purpose only.

  • How are you placing the dotted lines?

    It looks to just be nodes with a tiledbg stretched between nodes to make the lines.

    You could do an evert like this.

    On clicked on node
    Node overlaps line
    Pick all node
    Node overlaps line
    — Node var=5
    — — set text to “connected”
    — else
    — — set text to “not connected”
  • How are you placing the dotted lines?

    It looks to just be nodes with a tiledbg stretched between nodes to make the lines.

    Exactly how I did it. If the user taps on a node I want to create a solid line over the dotted line (so basically when there is a direct connection between two nodes). If there is no dotted conenction between two nodes I want to create a red line.

    Thanks for your input :)

  • My attempt, not very clean though:

    drive.google.com/file/d/1NQWBtVzhCaVIa5cpE0r-djpOEduG2WEm/view

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