Sprite visibility bug..or feature?
-
If you make a sprite invisible then for some reason collision detection still triggers on that sprite. Surely if you make a sprite invisible then it should also be invisible to collision tests?
-
@SteveZX81 That sounds like an almost philosophical question. Maybe it is in stealth mode?
-
I think it is perfectly reasonable that you might want a sprite to be invisible but still considered for all actions.
what I did was to
removeSprite(sprite)
but since I'm accessing sprites from arrays I would then get errors. I forget the actual text, something like "can't do that to a non-sprite" so I took a tip from Will's great Super Mega Blaster and created a sprite at the start called "nullSprite" and after removing the sprite, I assigned it to nullSprite.
So...
// Somewhere early on... nullSprite = createSprite() // Later on... removeSprite(spriteA) spriteA = nullSprite
As for the question of whether this is a bug or by design, I didn't dwell on it at the time and as soon as I saw that the sprite still responded as though it was visible I just did the above and moved on.
-
So the question is if this is by design or not I suppose?
-
I can verify but I would hope it is by design as I might well want an enemy to be able to go into stealth mode
-
It's by design. It is only setting visibility, nothing else. You can remove the sprite with
removeSprite()
, which will get rid of collision and all :) -
I would suggest creating your own extra variable then @SteveZX81, like mySpriteCollideAble[i] = true or false.
-
okay, sorry guys. my mistake
-
@SteveZX81 said in Sprite visibility bug..or feature?:
okay, sorry guys. my mistake
Not your mistake at all - just needed clarification!
-
@SteveZX81 Definitely not your mistake! It's a documentation issue which I'm going to raise an issue for to correct!
-
I have just been moving them off screen when I don't need them. . Finding a way off screen to see all these happenings always intrigued me in th ed 80's was like escaping into the code