How to Go Back X Frames Tutorial

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

How to Go Back X Frames Tutorial

Postby cpkspikyhair » Fri Jan 16, 2009 9:25 pm

----------------------------------
HOW TO GO X FRAMES BACK
----------------------------------

This is a tutorial on how to go X frames back. First, create these variant variables:

Code: Select all
0back
1back
2back
3back
4back
5back

Then, in all of the frames of your project (except the first one), have this executed when the frames are loaded:

Code: Select all
5back = 4back
4back = 3back
3back = 2back
2back = 1back
1back = 0back
0back = Action.GetCurrentFrameName


In the first frame, place this code:

Code: Select all
5back = Action.GetCurrentFrameName
4back = Action.GetCurrentFrameName
3back = Action.GetCurrentFrameName
2back = Action.GetCurrentFrameName
1back = Action.GetCurrentFrameName
0back = Action.GetCurrentFrameName


On the hotspot where you want to be taken to a frame when it is clicked, place this code:

Code: Select all
Action.GoToFrame = Xback


Where X is the amount of frames you want to go back (up to 5).

Hope this hels anyone that needs it!
PSPPC GameMaker!! Where you can find PSP and PC games up for download!
User avatar
cpkspikyhair
Games Page Administrator
 
Posts: 425
Joined: Thu Jun 28, 2007 1:49 pm
Location: On Mars (Yes There Is Water :) )

Postby pennsteve » Sat Jan 17, 2009 12:15 am

Maybe I am not understanding this, but why go to all that trouble when you can simply go to hotspot properties and choose the destination when its clicked?
pennsteve
Expert Member
 
Posts: 329
Joined: Wed Aug 06, 2008 3:55 pm

Postby cpkspikyhair » Sat Jan 17, 2009 1:07 am

The reason is if you go from an unknown frame to another frame and then another frame, then you may want to go back to the unknown frame. It wouldn't be possible without a code like this.
PSPPC GameMaker!! Where you can find PSP and PC games up for download!
User avatar
cpkspikyhair
Games Page Administrator
 
Posts: 425
Joined: Thu Jun 28, 2007 1:49 pm
Location: On Mars (Yes There Is Water :) )

Postby Lyberodoggy » Sat Jan 17, 2009 1:23 pm

This might be usefull too:
For the last code

Set framevarref=GetVariableReferenceFromName(number+"back")
Action.GoToFrame = framevarref.value

where by replacing number you get the value of the variable you want.
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens


Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests

cron