? Kicking myself right now (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password
What's going on?? See: Site Update March 2022

Kicking myself right now

  • #1 ✎ 82 Gaelstrom_Valence Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength First Month Joined in the very first month of SmileBASIC Source Website Been stuck for ages on something. Been using Bitwise stuff to handle collisions with map tiles. Worked well for basic tiles, 1 through 15, no hassle. But when I started to expand past that, then I ran into issues. I was hoping to have tile data all in one variable, stuff that doesn't specific instances at least, and thought I could just handle tiles past 15 as just IDs rather than Bitwise colliders. But then that was triggering collisions unnecessarily, then I was trying to figure out how to handle 1 way tiles, since the map editor treats them as regular tiles. I thought a bit flag could take care of that, but oh no that also messes with collision. Then I saw something on a game engine forum. And, that taught me that I could just, make collision bits less significant. Or, more, whichever. And then I realized. Oh wait. Isn't that kind of what smilebasic does with bgtile ids and rotation data. And yeah, that was quite a revelation. Also hi, I'm still around. Hope everyone's doing well. Posted
  • #2 ✎ 415 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Reading I like to read books! Hobbies Can any tile id have any collision property? It sounds to me like you're limiting yourself unnecessarily. Integers have 32 bits available, yet you're only using 4. Perhaps you could allocate some section of bits to store collision data: &B0000.000000000000 Period is a delimiter for show. From left to right, the first 4 bits may store collision properties (I'm guessing each bit turns a tile's corresponding side "on/off"), and the last 12 bits store the tile id, 0-4095. Posted Edited by MZ952
  • #3 ✎ 82 Gaelstrom_Valence Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength First Month Joined in the very first month of SmileBASIC Source Website
    Can any tile id have any collision property? It sounds to me like you're limiting yourself unnecessarily. Integers have 32 bits available, yet you're only using 4. Perhaps you could allocate some section of bits to store collision data: &B0000.000000000000 Period is a delimiter for show. From left to right, the first 4 bits may store collision properties (I'm guessing each bit turns a tile's corresponding side "on/off"), and the last 12 bits store the tile id, 0-4095.
    Yeah, that's the idea! My issue was I made the tile collision bits the least significant ones (I finally looked up which was which), which meant any number past the 15 would mess with those first 4 bits.
    Posted