LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

Please help me with collision boxes

Root / Programming Questions / [.]

SuperBeefJerkeyCreated:
I know how to resize and reposition sprites, and I know how to change their origin points, and how to detect collisions. All I need in that area now is to prepare a collision box of the right shape and size on a sprite that has been doubled in size and has had the point of origin adjusted. I'm trying to design a fight game without an 'HP' system.

I think you can do something with SPDEF but I haven't messed around with that yet and I'm not sure what to do with that.

The collision box should be automatically adjusted with the sprite scale, as long as you enabled that option in SPCOL. You have to run SPCOL again after changing the origin point though.
SPSET 0,0
SPCOL 0,TRUE
SPSCALE 0,2,2 'collision box is updated automatically

SPHOME 0,10,10 'collision box does not update
SPCOL 0,TRUE 'updated

Huh never noticed that, could have been useful a while ago. Can SPDEF be used for creating a custom hitbox?

Oh hey, thanks for the advice. I might have an opportunity to work on the program today. Speaking of which, I also need help with button controls. See, just doing this:
IF BUTTON(2)==2 THEN MOVE=1
(Not sure if I typed that correctly, I'm on the spot) is ok if you're using only one button at once, but each different button throws a different number, and when more than one button is hit at once, the numbers are added together and the instruction doesn't work. I could use some advice on that, too. (Should I make that a separate post?)

You're not doing it right. To accept button input do IF #WHICHEVER-BUTTON AND BUTTON(BUTTON-OPTION-NUM) THEN code... I.E.
WHILE 1
CLS
IF #A AND BUTTON(0) THEN ? "Pressed button A!"
VSYNC
WEND
If you hold console button A it will print "Pressed button A!" for as long as you hold it.

Thanks a huge load!! During the life of Miiverse, a Japanese user had given me a piece of code that worked for one of my programs, but I didn't understand it so it didn't work for my other program. Looks like my fight games will finally start to come together!