Discussions

SmileBASIC Community

PChickenNerdChicken

12/19/2016 9:28 AM ·Spoilers

Open Closed

How to correctly check for sprite collision?

It appears that my sprites collide even when not touching by their bounds. Is there any way to fix this problem?

Advertisement

Comment

This post has no comments.

  • You can use SPCOL Management Number, Star point X, Start point Y, Width, Height to specifie the collision box.

    Yeahs0
    Played
  • But will it really fix my problem?

    Yeahs0
    Played
  • Also, with SPHOME being 8,8 out of a 16x16 sprite, would the bounds be -8,-8,8,8?

    Yeahs0
    Played
  • No, SPHOME only edit the reference point of the sprite. You need to call SPCOL again to generate the new boundaries of the sprite. Run this program and see it by yourself: =========================================== SPSET 0,0 SPCOL 0 SPHOME 0,8,8 SPCOL 0 OUT X,Y,W,H ? FORMAT$("X:%D Y:%D W:%D H:%D",X,Y,W,H) SPHOME 0,8,8 SPCOL 0 SPCOL 0 OUT X,Y,W,H ? FORMAT$("X:%D Y:%D W:%D H:%D",X,Y,W,H)

    Yeahs1
    Played
  • Perhaps that is why my sprites kept colliding when not touching...

    Yeahs0
    Played

Add a Comment

You must sign in to post a comment.

Sign in using a Nintendo Network ID to connect to users around the world by writing posts and comments and by giving Yeahs to other people's posts. You can create a Nintendo Network ID using your Wii U console or your system in the Nintendo 3DS family.

Use of Miiverse Details about Miiverse

Report Violation to Miiverse Administrators

You are about to report a post with content which violates the Miiverse Code of Conduct. This report will be sent to Nintendo's Miiverse administrators and not to the creator of the post.

Violation Type:

Post ID: 3DB-NBL7-EJ9-9E2P-R7C-4JVH

Report Violation to Miiverse Administrators

You cannot report posts made automatically by a software title.

Edit Post

Select an action: