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 Studio Chat / [SOLVED] How do I make a sprite hide and ALSO not be hittable?

Author
Message
Jeku
Moderator
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Vancouver, British Columbia, Canada
Posted: 3rd May 2019 21:51
Hi all,

I've got some code that shows a sprite and then hides it, yet it still is hittable when invisible:



sprHit still detects the sprite, even though it's invisible and not active. What's the best way to remove the sprite so GetSpriteHit() doesn't detect it? I have solved it by repositioning it to -10000, -10000 but it seems hackey.

The author of this post has marked a post as an answer.

Go to answer

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 3rd May 2019 22:53
Crazy Programmer
AGK Developer
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Lost in AGK
Posted: 4th May 2019 04:48
If he is using raycast it will still hit the sprite even when its hidden so turning off the physics only helps if he is using physics. I would just delete the sprite and recreate it when you need it again.
Download My Games for Android. Made with AGK.
Jellyfish Dive- https://play.google.com/store/apps/details?id=com.CrazyProgrammerProductions.my_JellyFishSwim
Brick Destroyer - https://play.google.com/store/apps/details?id=com.CrazyProgrammerProductions.my_BrickDestroyer
Ping Bong - https://play.google.com/store/apps/details?id=com.CrazyProgrammerProductions.my_Pong_Ping_Bong
haliop_New
User Banned
Posted: 4th May 2019 06:12
This post has been marked by the post author as the answer.
No need to delete it or move it .
You can simply set this and any other sprite that you do not want to be touched using a group number that you wont use for collision testing.


Jeku
Moderator
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Vancouver, British Columbia, Canada
Posted: 6th May 2019 15:54 Edited at: 6th May 2019 18:50
Thank you!

Login to post a reply

Server time is: 2024-03-29 14:36:44
Your offset time is: 2024-03-29 14:36:44