0 Favourites

About Overlap at offset on center of a tile

  • I have a sprite (spriteA, 40x40 px) which has a Bullet behavior , and when I activate the bullet, the sprite will be moving forward.

    If the sprite A overlap a tile (same size, 40x40 px) called SpriteB , right on the center of the tile, it will activate something, or change the bullet direction (such as 270 degrees). The problem is, I dont know the overlap to offset coordinate. I've tried collision at imagepoint(0) but it doesnt work. Should I use Self.X or something ? Anyone could help ?

    E:/sprite.png[/img]

  • Relative.

    'Is overlapping at offset' moves the object temporarily 'offset' amount of pixels and checks the overlap, and then moves it back.

    With an offset x=20,y=-30, it moves the object (from its current position) 20 pixels on the x and -30 pixels on the y, checks for overlap (picks the objects) , and moves it back to current position.

    So, important to understand, it is not checking for collision at that one point in space. It checks the whole collision polygon's of one object against another object.

    If you want the offset to be an imagepoint.... then

    offset on x = sprite.ImagePointX(n) - sprite.X

    offset on y = sprite.ImagePointY(n) - sprite.Y

    I you want to check for an overlap at a certain point in space, you have the system condition Pick overlapping point.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Thanks . But to clarifying things, overlap means if a sprite touch another sprite (even by difference of 1 px) , it will be accounted as triggering something, right ? SO, in order to prevent this, I must make some sprites smaller by 1 or 2 px, right ? (in a maze-like level design)

  • Indeed. Or scale. Or use a helper object. Or pick Pick overlapping point. Or use an animationframe with reduced polygones, but that you cant do when working with physics.

  • 'Pick overlapping point' has a 'picking' side, but also a logic part. Can by very handy in a grid. This way (using the logic side).

    Pick (object) overlapping point (imagepoint)

    Else

    At this point you know that there is no 'object' on that place.

    So you could set some variable to represent a 'free' direction' to go.

    Or, just move in that direction.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
39 1,423
Zebbi's avatar
Zebbi
Unread hot topic
73 32,050
shubhamrathi9's avatar
shubhamrathi9
Unread hot topic
64 4,529
nimos100's avatar
nimos100