Drawing a loop around bubbles

0 favourites
  • 4 posts
From the Asset Store
2D Cartoon bubble shapes icons and bubble pop animation
  • How would i do this, so when the connection is made (in the loop) the bubbles are counted ?

  • The problem can be thought of how to find out if a point is inside a polygon.

    Here is capx with one solution:

    https://www.dropbox.com/s/q8geaer8sa26f ... .capx?dl=0

    Edit:

    You can eliminate the need for variables if you add a imagepoint to the right-center of the line object and do this:

    For each Sprite
    For each line
        | compare: line.y>sprite.y != line.ImagePointY(1)>sprite.y
        | sprite: x < (line.ImagePointX(1)-line.x) * (sprite.y-line.y) / (line.ImagePointY(1)-line.y) + line.x
        -----
            + Sprite: set animation frame to 1-Sprite.AnimationFrame[/code:wl2fbtnb]
  • R0J0hound - Why does changing the last part of the line (animation frame to 1-sprite.animationframe) break everything if you simply change it to "set animation frame to 1"

    isnt the code simply picking any sprite that's inside the lines, and changing their animation frame?

    The code is setting the sprite to frame 0, then after it picks all of the circles inside the drawn loop, to frame 1? (1 minus 0?) why doesn't simply having "set animation frame to frame 1 work instead?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The code looks at each line segment and toggles the selection of the points below them. It toggles it instead of setting it because it matters how many line segments are above a point. Basically if you take any point and draw a line straight up, and then count how many lines crossed you'll know if it's inside or outside. Odd:inside, even:outside.

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