Manually move a sprite to the EXACT same X/Y coords as another sprite, and it somehow doesnt think thats a collision or hit?
Im not sure if my install of DB is bugged or if Im missing something obvious or what, but it appears that both the SPRITE HIT and SPRITE COLLISION commands just do not work, at all.
In the game Im making right now I was setting up some pretty simple platformer controls. Player presses "A," character moves left. Player presses "D," character moves right. Player presses up arrow, character jumps up, decelerates, then falls down. I had all of that working, right up until the part where I tried to have the character stop falling when they hit the floor. I tried to do something along the lines of "IF SPRITE HIT(PlayerObject,0) then JumpSpeed = 0" which would have effectively made the player character stop moving on the Y axis when it collided with another sprite, such as the ones that make up the floor.
Problem was, that didnt work. I tried using "SPRITE COLLISION" instead of sprite hit. Same issue. Ive been messing around with it for several hours and it just seems like these two commands just DONT detect sprite collisions at all. Am I going crazy here or are these commands actually just not doing the ONE thing theyre designed to do?
I wrote some very basic test code to make sure it wasnt something else in my game, and remove variables from the equation, and the same problem persists. Moving an existing sprite onto the x/y coords as another existing sprite somehow doesnt get recognized as a collision or a hit, regardless of how that sprite is moved to that position. The ONLY thing that seems to actually trigger it to recognize a colission, is creating a NEW sprite at the same x/y coords as an existing one, but what use is that if I want to check whether my EXISTING character sprite has collided with the floor?
Below is the code I wrote to test it. The image "blank.png" was just a 100x100 pixel blank white image I made to test this.
sync on
sync rate 0
load bitmap "C:/Users/Username/Desktop/Gamejunk/Sprites/blank.png",1
set current bitmap 1
get image 1,0,0,100,100
sprite 1,200,200,1
sprite 2,500,500,1
Sprite 3, 700,700,1
delete bitmap 1
do
paste sprite 2,mousex(),mousey()
if upkey() then paste sprite 3,200,200
if spacekey() then sprite 4,200,200,1
if sprite hit(1,0) then print "YES"
if sprite collision(1,0) then print "Yeah!"
sync
loop
So yeah, I really dont know what I could possibly be missing. Those sprites are DEFINITELY colliding, and yet the SPRITE HIT and SPRITE COLLISION commands dont detect it when you move an existing sprite; only when you create a new one. Any ideas?