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/AppGameKit Studio Showcase / [Code] Full 2D Camera (Rotation included)

Author
Message
swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 14th Jun 2012 21:17 Edited at: 16th Jun 2012 21:53
A couple of people had asked for a way to rotate the AppGameKit camera. (We've all seen it coating the bug reports) As there are no built in solutions, I put together some code to do so. While I was at it, I included my motion based zoom trick as well, just in case anyone was curious(although it is easy to achieve). I chose to not implement full control over the zoom because the effect is already so easily achieved with the setViewZoom() command. Whether or not you're looking for full code, or just a way to get started writing your own code, this is a good place to look. Any questions or potential improvements are welcome.

Command Set

Code - no media required

At the moment sprites in the array will be forced to rotate from their center. Additionally, if a sprite has physics enabled, all of its velocities must be stored and reapplied after the sprites have been repositioned. I'll likely add support for both of these soon, but at the moment they are absent.

Lastly, here's a quick picture of the example (not that it's pretty). If you would prefer to add your own image to replace the white boxes, just import it and replace "temp = createSprite(0)" in addWorld() with "temp = createSprite(your image ID)" It will be automatically scaled.


Maybe one last bit. I couldn't get the setViewZoomMode() command to work properly. Within the code, I adjusted accordingly. I'm fully aware of the command.

swis
Joined: Tue Dec 16th 2008

Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 15th Jun 2012 11:42
Nice Thanks for sharing!

I don't have anything to use it on at the moment but I like the thinking behind this one.

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 17th Jun 2012 12:43 Edited at: 17th Jun 2012 12:44
Could come in handy

The effect reminds me about the work on the mode 7 engine?

I use an similar effect to get the race track

But only on one sprite!

Please put it in the code base so others dont miss it

Login to post a reply

Server time is: 2024-04-20 16:21:21
Your offset time is: 2024-04-20 16:21:21