Discussions

SmileBASIC Community

BradGamerZim

06/16/2016 7:39 PM ·Spoilers

Open Closed

sprite collision

Ok so I can do some fun and easy stuff, but how do i get sprite collision to work? the sample is just really vauge on how it works.

Advertisement

Comment

This post has no comments.

  • When you set a sprite also use spcol. This command sets a hit box to a sprite, use the help button for more info. To detect a collision use sphitsp, again, help button for more information. If you have more questions, ask away.

    Yeahs1
    Played
  • thanks man, you rock

    Yeahs0
    Played
  • wanted to make a small test, if player sprite touches npc sprite, it will beep, obviosly code is wrong, any tips?

    Yeahs0
    Played
  • You also need to set a hitbox for the npc

    Yeahs0
    Played
  • alright thanks, is am not sure if sphitsp is used right and how do i make the sprites solid to each other

    Yeahs0
    Played
  • Try the ranged sphitsp, the one with three numbers. To make sprites solid make a condition instead of beep. If b and 1 and move==true.... If sphitsp(0,1,2)>=1 then move=false else move=true

    Yeahs0
    Played
  • could you please send me a pick of this code in action? you'r a great help man! sorry if i seem dumb at this, i just have no coding experience so I don't have a understanding of complex coding (sprites and sprite actions)

    Yeahs0
    Played
  • alright, sp phases threw but beep activates when both sprites hit boxs meet. its a start

    Yeahs1
    Played
  • I have an old engine that i made, I'll see if I can send the code

    Yeahs0
    Played
  • The key is EED3K39J It isn't commented but it shows a bit of a broken sp collision, as well as how to use it

    Yeahs1
    Played
  • man your awesome, this is the most help I'v ever gotten on this

    Yeahs0
    Played
  • On both sprites, you must first use SPCOL on each one. SPCOL {sprite management number},TRUE Use that on each sprite, then use SPHITSP. IF SPHITSP( {management number of first sprite},{management number if other sprite} )THEN BEEP{number} That can also be used to set a variable.

    Yeahs1
    Played
  • Absolutely no problem, one of the reasons I check miiverse is to help people, so don't be afraid to ask questions

    Yeahs2
    Played
  • two questions about your code, how does the DI==&& do, and why is button commands a gosub vs a straight command in the loop?

    Yeahs0
    Played
  • DI stands for the direction that the sprite is facing, && is another way to type AND, and the movements are gosubs because that is how I organize my thoughts.

    Yeahs0
    Played
  • got ya, just curious. also noticed it helps sprites change without interference with other lines. tried diffrent things on your code to kinda figure things out, also your way is good, its easy for a beginer to figure things out

    Yeahs1
    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-BXN-3HKP-JWW-AV8K

Report Violation to Miiverse Administrators

You cannot report posts made automatically by a software title.

Edit Post

Select an action: