Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Hit a sprite that visibility set to 0?

Author
Message
gsdblack
12
Years of Service
User Offline
Joined: 6th Dec 2011
Location:
Posted: 9th Dec 2012 20:44
I am setting up my pause menu. At depth 5 I have resume, restart, and an exit sprite. On depth 4 I have Yes and no setup to make sure the player made the right choice. When I hit restart hit it also hits no button behind it even though its visibility is set to 0.


click on sprite code

load images

AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 9th Dec 2012 20:54
Please read this post:

Hiding a sprite and also disabling its interactions

Cheers,
AgentSam
gsdblack
12
Years of Service
User Offline
Joined: 6th Dec 2011
Location:
Posted: 9th Dec 2012 21:12
Thanks
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Dec 2012 21:50
Another, better way would be to use setSpriteActive to zero. Not sure why I didn't mention that in the other thread...


this.mess = abs(sin(times#))
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 9th Dec 2012 22:17
Quote: "Another, better way would be to use setSpriteActive to zero. Not sure why I didn't mention that in the other thread..."


I'm not near AppGameKit at the moment, but I don't think setSpriteActive made any different in my case from the original thread (when using GetSpriteHit, at least). In fact I mention that it didn't help in my original post with the code snippet that seems to confirm this.
gsdblack
12
Years of Service
User Offline
Joined: 6th Dec 2011
Location:
Posted: 9th Dec 2012 22:34
"Uses the shape assigned to it from SetSpriteShape. If no shape is set it uses the sprite width and height as a box shape."

This is from the documentation so setspriteactive and setspriteshape to 0 wont work. I will move the sprites from off the screen.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Dec 2012 08:05
That would be why I didn't mention it... I will check your code example and get back to you as that is the correct command. I use it a lot, what version of AppGameKit are you using?


this.mess = abs(sin(times#))
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 10th Dec 2012 08:59
In theory, SetSpriteShape(spr, 0) looks like an answer but I can't get it to work on this end (OS X v1076). It won't change the sprite's collision shape from a box to nothing. Maybe it's been fixed for 108 but I'm not sure.

Code for those who are curious:


baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Dec 2012 10:14
The "setSpriteShape(spriteID, 0)" solution appears to be broken in v108 so until it is fixed you can use this "setSpriteShapeCircle(spriteID, 0, 0, 0)" to get the same effect.

setSpriteActive only sets whether Physics or Animation is active contrary to my own previous belief


this.mess = abs(sin(times#))

Login to post a reply

Server time is: 2024-11-24 03:59:59
Your offset time is: 2024-11-24 03:59:59