360-degree panoramas: how to go back to the last position

This forum is meant for people to share their knowledge by writing their own tutorials for Adventure Maker.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

360-degree panoramas: how to go back to the last position

Postby GM-Support » Mon Jan 21, 2008 1:29 pm

.
In a 360-degree panoramic game, how to go temporarily to a 2D frame and then return to the EXACT position in the previous panoramic frame?


Tutorial:

1. First, create two new global variables of type "variant" named for example "LastX" and "LastY" (to do so, just click "VBSVariables" from the Adventure Maker menu on the left)


2. Then, go to the location where you want the game to move to the 2D menu frame. For example, it can be a hotspot, or the "Advanced" tab of the Project Properties if you want the menu frame to appear when you right-click or when you press Esc.

In addition to checking the option "Go to another frame" and choosing the 2D frame, also execute the following code to remember the current position in the panorama:
Code: Select all
LastX = CStr(Component("AMPano").Object.GetHorizontalCameraAngle * 180 / 3.141593)
LastY = CStr(Component("AMPano").Object.GetVerticalCameraAngle)



3. Then, go to the location where you want the game to come back to the panorama. For example, it can be a hotspot with a text saying "Go back to the game". Or, if you have zoomed on an object, it can be a hotspot with a text saying "Zoom out".

In addition to checking the option "Go to another frame" and "Last visited frame", also execute the following code to tell the engine that the next panoramic frame should have the specified initial camera angles:
Code: Select all
LastY = Replace(LastY, ",", ".")
AMPanoChooseViewpoint LastX, LastY


Note: the first line of the code allows supporting the systems that use a comma instead of a point for decimal numbers (I hope there are no other special formats in other countries, otherwise we will need to handle them here).
GM-Support
Forum Admin and Games Page admin
 
Posts: 2221
Joined: Thu Jun 05, 2003 7:52 pm

Postby markmack » Mon Jan 21, 2008 9:25 pm

This code works great for programming your own custom menus in a panoramic game.

For example, in my game I have a complex menu (including options, inventory, and a map system) pop up when you right click -- and right clicking again takes you back to exactly where you left off.

And with this code it's incredibly easy to do! 8)
markmack
New Member
 
Posts: 5
Joined: Mon Jan 14, 2008 1:03 am

Postby GM-Support » Mon Jan 21, 2008 10:22 pm

Thanks! I am glad it's useful.
GM-Support
Forum Admin and Games Page admin
 
Posts: 2221
Joined: Thu Jun 05, 2003 7:52 pm


Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests

cron