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.

Newcomers AppGameKit Corner / [SOLVED] GetPointerPressed - query - seems interitttant

Colin Hart
Years of Service
User Offline
Joined: 28th Apr 2003
Location: United Kingdom
Posted: 8th Feb 2020 19:11
Evenin All.

Woundering if soeone can assist, I have writing some code that relies on detecting the user pressing / holding a sprite on the screen. When I get use GetPointerPressed / hitsprite sometimes it does work sometimes it doesn't or require many taps.... both screen and mouse.

Here is my code:

Has anyone else experianced this / how did you slve it?

Thanks for reading..



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

Go to answer

Years of Service
Recently Online
Joined: 12th Sep 2006
Posted: 8th Feb 2020 21:31
This post has been marked by the post author as the answer.
From the code snippet provided, I cannot determine when your variable button_released is equal to 1, which is needed to determine if the mouse button is pressed. I have copied a part of the help from the GetPointerPressed() section. It might help guide you depending on what you really want to happen when the pointer is pressed. Maybe use GetPointerState():

"There are three commands for getting the state of the pointer press, GetPointerPressed returns 1 the instant the pointer is pressed and then returns 0, GetPointerReleased returns 1 the instant the pointer is released and then returns 0, GetPointerState returns 1 the entire time the pointer is in the pressed state. "
Colin Hart
Years of Service
User Offline
Joined: 28th Apr 2003
Location: United Kingdom
Posted: 9th Feb 2020 10:21
Cheers JosephB, I had perfect success by querying the GetPointerState() instead of GetPointerPressed().

Best Regards

Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 10th Feb 2020 13:28
Hi. Just a Tip. To get more accurate touches, I some times read 9 points, to see if I clicked a fast moved sprite. Center, then 8 points in a circle around it, some pixels away. That way I can get more accuracy. I guess you also could place an invisible large sprite under the center point, and check if that collided with anything, but I have not tried that

Login to post a reply

Server time is: 2020-04-06 20:17:24
Your offset time is: 2020-04-06 20:17:24