? How do you make a sprite collide with a bigger sprite? (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password
Space-Restriction Challenge QSP Phase Ends on March 26!

How do you make a sprite collide with a bigger sprite?

  • #1 ✎ 12 Finnow Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Video Games I like to play video games! Hobbies Ok, so basically I’m trying to make a 2d platformer, and the platforms are bigger than the player, plus I have no idea on how to do collision stuff. Any tips? Posted
  • #2 ✎ 258 ProKuku Avatar Taboo I didn't change my avatar for 180 days Website Final(?) Contest Runner Up I placed 2nd in the (possibly) final SmileBASIC Source Contest! October 2018 Programming Contest Cthulhu Join the cult Easter Eggs Hmmm it’s been a while since I’ve done something SB related on here... I’m assuming the platforms for your game are sprites? If so, you should be able to initiate collision-checking between the player and platforms simply by doing SPCOL player-sprite number SPCOL platform-sprite numberEDIT: you have to type SPCOL a whole two times 😰 Then, to do something (like keeping the player from falling) when the sprites actually collide, you’d write something like IF SPHITSP(1,0) THEN ... with the two numbers being the two sprites you want to check for collision with. This would be pretty inefficient, however, since you’d have to make sprites for each platform and put them precisely where you want. It would be better to put the platforms directly into your map (if you’re using one) and then figure out collision for the player and platform map tiles. Um anyway this has been going on long enough. Tell me if you’d like to try the slightly more complicated map-tile solution, or stay with the easier-to-understand solution with sprites for the player and platforms I think I used too many italics and bolds Posted Edited by ProKuku
  • #3 ✎ 12 Finnow Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Video Games I like to play video games! Hobbies ah, so THATS how that works! Thank you very much! Also sticking to sprites but will ask for help with that if I end up needing it. Posted
  • #4 ✎ 12 Finnow Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Video Games I like to play video games! Hobbies Ok so I’m trying to use Sphitsp in a while function, but it freezes the game. Any explanation for why this happens? WHILE SPHITSP[TILE,PLAYER] PLAYERYVOL=0.1 PLAYERY=PLAYERY+PLAYERYVOL WEND Posted Edited by Finnow
  • #5 ✎ 306 Minxrod Third Year My account is over 3 years old Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Video Games I like to play video games! Hobbies That will loop forever since nothing is changing the location of the sprites, so if the SPHITSPis false it stays false. (You might add a SPOFS into the loop, or just use an IF statement.) Posted Edited by Minxrod
  • #6 ✎ 12 Finnow Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Video Games I like to play video games! Hobbies Ohhhh ok, now I feel dumb. Posted
  • #7 ✎ 258 ProKuku Avatar Taboo I didn't change my avatar for 180 days Website Final(?) Contest Runner Up I placed 2nd in the (possibly) final SmileBASIC Source Contest! October 2018 Programming Contest Cthulhu Join the cult Easter Eggs Also, don’t hesitate to ask another question if you have one. I know from experience that fixing one issue usually leads to 3 more popping up. Posted
  • #8 ✎ 12 Finnow Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Video Games I like to play video games! Hobbies Well, there is one issue, but I have no idea how to describe it. You can’t jump when walking against a wall, or you fall as if you have a wall jump ready when moving at a wall but I have yet to implement wall jumps, I guess? Posted Edited by Finnow
  • #9 ✎ 258 ProKuku Avatar Taboo I didn't change my avatar for 180 days Website Final(?) Contest Runner Up I placed 2nd in the (possibly) final SmileBASIC Source Contest! October 2018 Programming Contest Cthulhu Join the cult Easter Eggs Hmm that does sound odd... the only thing I can think of is perhaps your wall collision is counteracting your jumping. Like when you walk into a wall you would do SPOFS X-1, Y or whatever it is. Then your jumping, though I don’t know how you’ve made it work, could be messing with that X-1 somehow. I’m not really sure, though, just a guess. Posted
  • #10 ✎ 12 Finnow Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Video Games I like to play video games! Hobbies Makes sense. Thanks! Posted
  • #11 ✎ 12 Finnow Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Video Games I like to play video games! Hobbies Ok, so there’s a glitch that I can’t fix, so I’ve uploaded the unfinished engine for it, so if any of you wanna fix it, the code is QKX3QDNP. Posted
  • #12 ✎ 1697 12Me21 Head Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself One thing I'd recommend is to use multiple variables for the player position (PLYRX, PLYRY, etc.) rather than an array (PLYR[4]) since It's easier to understand PLYRX than PLYR[0] Also, if you want to check if a button is being pressed, you should use B AND (button number) This will detect the button even if other buttons are being pressed. You can use constants like #A, #B, #LEFT, #RIGHT, etc. to avoid having to memorize the button numbers (so, IF B AND #LEFT THEN ...) Posted
  • #13 ✎ 12 Finnow Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Video Games I like to play video games! Hobbies I just thought having an array instead of 5 separate variables would be more convenient, considering I was gonna add enemies. And as for the tags instead of numbers for detecting buttons, I didn’t know you might be able to say if B and #a and #b or something instead. Posted
  • #14 ✎ 105 seggiepants I took a look at your code, and I see a Stack Overflow error. You are losing stack memory on every level change because you use GOSUB without RETURN. Stop using GOTO/GOSUB, it does that way too easily. You only have one call to each and it still bit you. You should practice functions so you can use those instead, they are much better. Using sprites instead of BG is an interesting design decision. However, you only get 512 or so. If you finish the game you aren't going to have many left over for coins and enemies, etc. However, I think Passocom mini took away the BG system and added more sprites to compensate. Maybe SmileBasic switch will do the same thing. I will consider it a contingency plan. That and I think you want the Sprite collision system to do the work of background collision for you. Speaking of which, you probably don't want collision turned on for sky sprites (dark blue). Also you seem to be recreating the entire level every frame, move that outside of the main loop. I would suggest calculating the new position and testing it with sphitrc before moving the player. I tried playing around with it, but I ended up just taking out all the collision code and putting in my own, and still you can slip into a block on a corner if you try. Not very helpful to post it yet because of that. I was thinking of making a platformer game tutorial series. It would be very long. You wouldn't even get to platforming until episode 3 and may never get to sloped terrain or moving platforms. Would anyone want me to make that? Again long and complex, not a beginner tutorial. Posted
  • #15 ✎ 12 Finnow Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Video Games I like to play video games! Hobbies Again, I’m not continuing this platformer. You can fix it however you like, but I’ve stopped working on it. Posted
  • #16 ✎ 258 ProKuku Avatar Taboo I didn't change my avatar for 180 days Website Final(?) Contest Runner Up I placed 2nd in the (possibly) final SmileBASIC Source Contest! October 2018 Programming Contest Cthulhu Join the cult Easter Eggs [url=https://m.youtube.com/watch?v=Wz_DNrKVrQ8]https://m.youtube.com/watch?v=Wz_DNrKVrQ8[/url] Posted
  • #17 ✎ 12 Finnow Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Video Games I like to play video games! Hobbies I did just start programming a puyo puyo clone, but I probably won’t be allowed to upload it ever. Yknow, what with puyo puyo Tetris and all that. Posted
  • #18 ✎ 105 seggiepants Well OK, be that way, I was only trying to help. Guess I will count that as a no on the tutorial series idea too. Sniff sniff, woe is me. By the way if you don't take the Puyo Puyo name, story, graphics, music, or sounds and change up the gameplay a small amount, you probably won't have any problems. I mean how many Street Fighter II, Doom, Side Scrolling Beat-em ups, Racing Games, and so on and so on are there. Posted