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 / Selecting a sprite with the mouse?

Author
Message
Ignatios
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location:
Posted: 14th Mar 2015 06:01
I have been trying to figure out how I could select a sprite by clicking on it. I found a way to do this using a lasso effect as seen with RTS games, however I am making a warmachine tabletop style game. I could accomplish this using buttons over each sprite, but only a maximum of 12 are allowed active on the screen at any time, so I am trying to avoid a clunky UI by just trying to code in a way to select a sprite by clicking on it..Any help would be appreciated
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 14th Mar 2015 10:11
This can be done using GetPointerPressed() and GetSpriteHit() or GetSpriteHitGroup(). Take a look at these commands and you'll have a better idea how they work. I never use buttons, I prefer to make my own

Using AppGameKit V2 Tier 1
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 14th Mar 2015 20:03
also useful
GetSpriteInBox ( iSprite, x1, y1, x2, y2 )
GetSpriteInCircle ( iSprite, x1, y1, radius )

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)

Login to post a reply

Server time is: 2024-06-17 00:31:56
Your offset time is: 2024-06-17 00:31:56