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.

Author
Message
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 24th Jan 2012 21:22
I want to have the player touch the screen, drag his finger in semi-circle fashion, and form a pie/sector of a circle object on the fly.

Unfortunately we have no line or image manipulation commands in AGK.

Does anyone have any good idea how to achieve this effect without creating hundreds of sprites?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th Jan 2012 10:49
You could reduce the amount of sprites by having pre-drawn half / quarter / eighth etc. size slices and then use the minimum required to make the current slice.

EG. The user has drawn a total of:
228 degrees = 180(1/2) + 45(1/8) + 3(1/360) = only 5 sprites
65 degrees = 60(1/6) + 5(1/360) = only 6 sprites
...and so on

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 25th Jan 2012 12:40
Yes Baxslash this is the method I am using now. I split the screen in 16 parts, using predrawn sprites.

Seems like its the best solution for the commands we have now.
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 27th Jan 2012 01:19
Actually using tiny slices of circle being rendered with Sprites is the way to go as you get maximum performance and a very smooth app. If you drew the pixels manually, your app would have different performance metrics depending on the device you are running on. It is always 1000% preferred to prepare your graphics in advance and find nifty ways to render them as finite elements (if you want performance). We are looking at some cool 'image generation' commands for AppGameKit, but even with them integrated, I would still recommend the old 'prepare assets before loop - prepare nothing inside loop' approach.

I drink tea, and in my spare time I write software.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 27th Jan 2012 08:50
For your sprite circle section, if you include the centre point of your circle in the sprite (albeit invisible), you can simply offset the sprite, rotate and save a lot of calculations.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 27th Jan 2012 10:17
Yes I am now using pre-rendered sprites as suggested.

Thanks guys

Login to post a reply

Server time is: 2024-11-23 02:14:28
Your offset time is: 2024-11-23 02:14:28