setSpriteZPos() - gives error when using 0/1

Report any Hollywood bugs here
Post Reply
peceha
Posts: 111
Joined: Tue Dec 13, 2016 8:39 am
Location: Poland

setSpriteZPos() - gives error when using 0/1

Post by peceha »

Hi,
setSpriteZPos() throws an error:
Wrong usage/parameters for this command!
Read the documentation!
whenever I'm trying to bring to front (0) the sprite which is already in front or moving to the back (1) when the sprite is already at the back.

For example:

Code: Select all

SetFillStyle(#FILLCOLOR)

CreateBrush(0,100,100,#WHITE)
CreateSprite(0,#BRUSH,0)
DisplaySprite(0,0,0)

CreateBrush(1,100,100,#RED)
CreateSprite(1,#BRUSH,1)
DisplaySprite(1,50,50)

SetSpriteZPos(0,1) ; this line produces error msg. Changing to (1,0) gives an error as well

WaitKeyDown("any")
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: setSpriteZPos() - gives error when using 0/1

Post by airsoftsoftwair »

Well, yeah, the answer is already in your question. You're trying to bring a sprite to front which is at the front already and you're trying to bring a sprite to back which is at the back already. Of course SetSpriteZPos() fails then... it can't do anything that's already been done.
peceha
Posts: 111
Joined: Tue Dec 13, 2016 8:39 am
Location: Poland

Re: setSpriteZPos() - gives error when using 0/1

Post by peceha »

But is the error message necessary in that case ? I do not want my program to be stopped because of something that is ... not an error (in my opinion) ;)

Thanks
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: setSpriteZPos() - gives error when using 0/1

Post by airsoftsoftwair »

Then just use:

Code: Select all

ExitOnError(False)
SetSpriteZPos(...)
ExitOnError(True)
peceha
Posts: 111
Joined: Tue Dec 13, 2016 8:39 am
Location: Poland

Re: setSpriteZPos() - gives error when using 0/1

Post by peceha »

Thanks. Didn't think of it.
marko
Posts: 56
Joined: Wed Dec 15, 2010 5:19 pm
Contact:

Re: setSpriteZPos() - gives error when using 0/1

Post by marko »

I ran into this issue as well, it caused some major headach :S...

Ah, now I know, thanks both
AmigaOS 4.1 on Sam440ep-flex@800MHz
http://www.m4rko.com/amiga
Post Reply