I'm getting the error ' Sprite 0 is not on screen!' for this collision check below but I only defined Sprites 1,2, and 3
-----------------------------------------------------------------------
If Collision(#SPRITE, sprite1, sprite3) = True
DisplaySprite(2, 0, 0)
Else
DisplaySprite(3, 0, 0)
EndIf
help with sprite collision
help with sprite collision
A1-X1000- I BELIEVE
Re: help with sprite collision
We need to see more of the code. Which values have you assigned to the variables sprite1 and sprite3? You need to give them the same number as the corresponding sprites
When I work with sprites I use constants with describing names instead of variables:
And then I use the constants throughout the program when referring to the sprites
Makes it easier to read your own code later on when sprite are described with names instead of numbers or digits.
When I work with sprites I use constants with describing names instead of variables:
Code: Select all
@SPRITE 1, "I-PointBlack.png", {Transparency = #WHITE}
Const #Ipoint = 1
@SPRITE 2, "Sword32x20transWhite.png", {Transparency = #WHITE}
Const #Sword = 2
Code: Select all
If Collision(#SPRITE, #Sword, #Ipoint) = True
...do stuff...
EndIf
_____________________________________
Hollywood 6.1
Hollywood 6.1
Re: help with sprite collision
Well, this is even better, the constants first!fjudde wrote: When I work with sprites I use constants with describing names instead of variables:Code: Select all
@SPRITE 1, "I-PointBlack.png", {Transparency = #WHITE} Const #Ipoint = 1 ...
Code: Select all
Const #Ipoint = 1
@SPRITE #Ipoint, "I-PointBlack.png", {Transparency = #WHITE}
_____________________________________
Hollywood 6.1
Hollywood 6.1