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 / spriteToWorld (by offset) - free code

Author
Message
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd Dec 2011 11:29 Edited at: 23rd Dec 2011 11:31
Here's a couple of fairly simple functions I've been working on to save me some headaches. I thought I'd share them.

Basically you have to initialise a single global variable to allow for both percentage and virtual resolution set-ups.

You can use this to get a position on your sprite in world co-ordinates (even if the sprite is rotated). Here's the code with a sample project (attached with media):

To test virtual resolution / percentage based just remark out the first / second line accordingly. The init sub-routine allows for both types.

EDIT: forgot to attach the project

Attachments

Login to view attachments
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 23rd Dec 2011 13:46
Thanks for sharing, this will come in useful!

LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 6th Jan 2012 11:26
I have added it to our internal suggestions list (SetSpriteClip) as I can see a few cool applications of this, though you will appreciate using a clipping plane will degrade graphic rendering performance

I drink tea, and in my spare time I write software.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 6th Jan 2012 11:36
Hi Lee! I think you posted this in the wrong thread?

Might be nice to add a version of this command too though?

LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 6th Jan 2012 13:33
I think I just had a Chrome browser hiccup

I drink tea, and in my spare time I write software.

Login to post a reply

Server time is: 2024-11-22 20:27:55
Your offset time is: 2024-11-22 20:27:55