Discussions

SmileBASIC Community

MSWScoolestkid123

05/01/2016 3:46 AM ·Spoilers

Open Closed

How to test for sprite collision

Someone please explain to me how to detect 2 sprites touching! If you could use MAN and DRG as the two sprite def. numbers then thanks!

Advertisement

Comment

This post has no comments.

  • Heres a little sprite collision code. SPSET 0,0,0 SPSET 1,16,0 SPHOME 1,-50,-100 SPCOL 0 SPCOL 1 @BUMP SPOFS 0,X,Y,-10 B=BUTTON IF B AND 1 THEN GOSUB @UP IF B AND 2 THEN GOSUB @DOWN IF B AND 4 THEN GOSUB @LEFT IF B AND 8 THEN GOSUB @RIGHT GOTO @BUMP continued...

    Yeahs1
    Played
  • @UP Y=Y-1 VSYNC 1 IF SPHITSP(1,0) THEN ACLS RETURN @DOWN Y=Y+1 VSYNC 1 IF SPHITSP(1,0) THEN ACLS RETURN @LEFT X=X-1 VSYNC 1 IF SPHITSP(1,0) THEN ACLS RETURN continued...

    Yeahs1
    Played
  • @RIGHT X=X+1 VSYNC 1 IF SPHITSP(1,0) THEN ACLS RETURN Hope i helped!

    Yeahs1
    Played
  • @nate Thanks for the code, i'll try it out as soon as I can!

    Yeahs1
    Played
  • It works! I wasn't doing spcol for both sprites, just 1! Thanks @nate. I also shortened the code a little.

    Yeahs1
    Played
  • Your welcome :)

    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-BXM-ZM9C-ZD8-MR4W

Report Violation to Miiverse Administrators

You cannot report posts made automatically by a software title.

Edit Post

Select an action: