GAMELEGEND 2021-01-03 05:02 (Edited)
like always I am making another RPG
but my question is after a enemy gets killed would it be a good idea to set that sprites x and y to 0 or does it not matter
for example
sprite 1 is a enemy
sprite 1 gets killed
reset sprite 1's x and y to 0 until another enemy is ready to spawn using sprite 1
was8bit 2021-01-03 05:54 (Edited)
To "hide" a sprite, set its image to a blank... OR you can simply set its X location to 161 which will place that sprite out of view... remember that any sprite with an image will still register with SPRITE HIT, but a sprite set to a blank image will not register with SPRITE HIT...
Also, there is these commands...
SPRITE OFF [n]
SPRITE OFF a TO b
When you turn a sprite off, then SPRITE HIT will not register it... actually, in effect, you have reset that sprite # back to complete non existence... you will have to set its x,y,and cell# all over again to make it appear again..
Personally, i just set its image to blank, its the easiest method for me... then all you have to do it reset its image and you are good to go :)
(Remember, if you use a bigger sprite, you will need a bigger blank space... so a 2x2 sized sprite (SIZE 1) will need a 2x2 blank space to make it all disappear)
GAMELEGEND 2021-01-03 06:27
I knew how to hide a sprite but i did not know I can do the other stuff I wanted to do with SPRITE OFF
thanks :)
was8bit 2021-01-03 06:51
Glad i could help :)
Timo 2021-01-03 08:30
The “official” way is SPRITE OFF. It actually sets the sprite position to -32,-32, which is the most top left position and it’s out of screen.
was8bit 2021-01-03 10:35
@Timo, i had did a test on SPRITE OFF, and it failed to recover, is why i stated what i did.... i had then deleted my experiment..
Upon your statement, i recreated the test, and this time it passed... so obviously i meesed up the original test somehow...
GAMELEGEND 2021-01-04 00:55
so are all unused sprites at -32 -32 or do they only go there when you use SPRITE OFF
was8bit 2021-01-04 05:36 (Edited)
I am not sure... i did another test, and ANY sprite that is completly off the visible page will NOT register with SPRITE HIT, even if it has an image ....
So, i will be using SPRITE OFF more often now ;)
Timo 2021-01-04 07:33
The is no special value for a sprite for on and off. All sprites are by default at -32,-32 and the SPRITE OFF command sets them back to this position.
If you PEEK the sprite position registers, you will see that -32 is actually 0, and screen position 0,0 is for a sprite 32,32. The BASIC commands already include this offset.
If the internal position byte was a normal signed integer, it range would be -128 to 127, so the maximum positive value wouldn't be enough to reach the right side of the screen (160). That's why it's an unsigned integer with an offset.