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 / How to make a large arrow pointer for a PC game, with full functionality?

Author
Message
Mark Garrett
Reviewed AGK on Steam
19
Years of Service
User Offline
Joined: 10th Jul 2005
Location: California, US
Posted: 19th Aug 2017 22:08 Edited at: 19th Aug 2017 22:22
I made a larger arrow pointer on my pc game, but, problem is, the arrow is made out of a sprite, and therefore cannot detect sprites underneath itself.... it only detects itself.

Because since the pointer is made out of a sprite, it cannot detect the sprites underneath it, and therefore ends up blocking itself from the sprites underneath.

The pointer only detects itself, and therefore says that the sprite underneath it is itself (sprite #499)



So, I guess my question is - Is there a way to replace the mouse pointer completely with a larger ?
.

Attachments

Login to view attachments
Supertino
7
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 19th Aug 2017 22:14 Edited at: 19th Aug 2017 22:27
You could maybe offset the pointer sprite by 1 px


Mark Garrett
Reviewed AGK on Steam
19
Years of Service
User Offline
Joined: 10th Jul 2005
Location: California, US
Posted: 19th Aug 2017 22:25 Edited at: 19th Aug 2017 22:29
No, I have tried that, and thought the same thing,

but the 'windows 7' mouse pointer is located above sprite #499, and therefore cannot detect sprites underneath sprite #499..(sprite #499 being the new pointer)

In other words, the new mouse pointer blocks detection of sprites underneath it, because, it is, in itself, in the way.
.
Supertino
7
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 19th Aug 2017 22:28 Edited at: 19th Aug 2017 22:43
You could maybe offset the pointer sprite by 1 px




i think you need to go another route, keep the pointer sprite, but make an invisible 1x1px sprite that sits at the top left of the pointer sprite but make it not visible then check for collections

Mark Garrett
Reviewed AGK on Steam
19
Years of Service
User Offline
Joined: 10th Jul 2005
Location: California, US
Posted: 19th Aug 2017 22:46

Cool !, yes, is working good now. Good suggestion.
.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 23rd Aug 2017 16:29
I like to group my sprites using SetSpriteGroup. That way I can use the "getspritehitgroup" command to check for clicks.
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 23rd Aug 2017 16:54
I had the same problem the other day. I found that it works if you move the mouse pointer to where you've touched after you've detected the sprite hit i.e.

spriteHit = GetSpriteHit(GetPointerX(), GetPointerY())
SetSpritePositionByOffset(spritePointer, GetPointerX(), GetPointerY())

Something like that. I wrote this away from a copy of AppGameKit but you get the idea.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 25th Aug 2017 07:17
you could use the following function



Or ofcourse you could group the sprites as previously suggested
and use GetSpriteHitGroup(groupId,x,y)
fubar
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 25th Aug 2017 11:24 Edited at: 25th Aug 2017 11:24
it depends on the situation, but I often use GetSpriteHitTest() command with array of known sprites or known buttons. It's working like a charm even with a custom sprite as cursor (only checks if it's overlapping)
--------------------------------
Join us on dedicated AppGameKit WeeKChat :
https://week.chat/room/AppGameKit

Login to post a reply

Server time is: 2024-11-24 09:51:03
Your offset time is: 2024-11-24 09:51:03