How do Construct 2 checks Sprite.X,Sprite.Y?

0 favourites
  • 2 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • I have a sprite with bullet behavior and its angle of motion is set to another sprite that I would like to share the same X Y coordinate with. Like this:

    Set bullet angle of motion to: angle(Sprite1.X,Sprite1.Y,Sprite2.X,Sprite1.Y)

    Set bullet speed to: 100

    And I set Sprite1 to destroy when they both suppose to share the same X Y coordinate, but nothing happens.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Bullet doesn't move with pixel precision. You can't just compare x and y of both sprites. Use distance() expression to check if two sprites are close enough, or Line Of Sight behavior with a very small radius, or collision with small collision polygons.

    Note, that if Bullet speed is fast and/or fps is low, then your sprite may travel big distances between each tick and it may actually miss/skip the point where it overlaps another sprite.

    That's why I recommend not using Bullet at all. Try MoveTo addon, it's much better suited for this task:

    scirra.com/forum/behavior-moveto_t63156

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