setSpriteZPos() - gives error when using 0/1

Report any Hollywood bugs here

setSpriteZPos() - gives error when using 0/1

Postby peceha » Mon Sep 25, 2017 10:59 pm

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")
peceha
 
Posts: 111
Joined: Tue Dec 13, 2016 9:39 am
Location: Poland

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

Postby airsoftsoftwair » Wed Sep 27, 2017 7:35 pm

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.
User avatar
airsoftsoftwair
 
Posts: 2283
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

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

Postby peceha » Wed Sep 27, 2017 7:56 pm

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
peceha
 
Posts: 111
Joined: Tue Dec 13, 2016 9:39 am
Location: Poland

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

Postby airsoftsoftwair » Wed Sep 27, 2017 8:21 pm

Then just use:

Code: Select all
ExitOnError(False)
SetSpriteZPos(...)
ExitOnError(True)
User avatar
airsoftsoftwair
 
Posts: 2283
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

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

Postby peceha » Wed Sep 27, 2017 8:43 pm

Thanks. Didn't think of it.
peceha
 
Posts: 111
Joined: Tue Dec 13, 2016 9:39 am
Location: Poland


Return to Hollywood bugs

Who is online

Users browsing this forum: No registered users and 2 guests

cron