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 / can i disable a sprite hit with GetSpriteHit(x,y) ?

Author
Message
haliop_New
User Banned
Posted: 1st Apr 2016 10:36
meaning ...

if i have 10 sprites , but i want only 1 to be hit enabled ? can i disable the other 9 from returning a value using GetSpriteHit ?
for now what i do is placing all the sprites in a diffrent position when using getspritehit

pseudo code


if GetPointerPressed()=1
for i = 1 to 9
SetSpritePosition(sprites[i],OffscreenValueX,offScreenValueY)
next i
hit = GetSpriteHit(PointerX,pointerY)
for i = 1 to 9
SetSpritePosition(sprites[i],originalXvalue,originalYValue)
next i
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 1st Apr 2016 11:15
there are some more commands

GetSpriteHitTest ( iSpriteIndex, x, y ) <<<<<<<<<<
GetSpriteHitCategory ( categories, x, y )
GetSpriteHitGroup ( group, x, y )
AGK (Steam) V2.0.18 : Windows 10 Pro 64 Bit : AMD (15.30.1025) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 1st Apr 2016 12:25
I use the Sprite Group method that Markus suggests.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 1st Apr 2016 13:57
Yep, use sprite groups.
haliop_New
User Banned
Posted: 1st Apr 2016 16:22
thank you.

Login to post a reply

Server time is: 2024-11-25 08:35:36
Your offset time is: 2024-11-25 08:35:36