The Daily Click ::. Forums ::. Klik Coding Help ::. n00b TGF Problem
 

Post Reply  Post Oekaki 
 

Posted By Message

Rydenio



Registered
  19/04/2006
Points
  42
22nd April, 2006 at 13:48:55 -

Hey guys, I have a slight problem with my little RPG I'm making in TGF. I'm a total newbie and I don't know any advanced techniques so I'd be thankful for some help and for you to not pick on me because i have no clue.

Here's the deal. I have a Level 1 which is the town area, and the player starts in the center of it. In that area is a house with a door, and under the toor tile is a red tile that you don't see but I made it so that when they player object collides with that tile you enter the house. So good so far.

So then you are transported to Level 2, which is the house interior. And at the bottom of the interior there is a door, once again with na invisible tile that transports the player back to Level 1 on collision.

But here's the problem, and this is probably really silly, but when you exit the house you obviously go back to Level 1, but the player object will be located in the center of the map again since the level was just restarted. So I'm wondering if there is any way to code it so that when you enter the nevel after being on level 2, the player object will start outside the door to the house?

I know one solution would be to make many version of Level 1, but I'd like to avoid that if possible. I would appreciate any help.

 
n/a

Hayo

Stone Goose

Registered
  15/08/2002
Points
  6946

Game of the Week WinnerHas Donated, Thank You!VIP MemberGOTM 3RD PLACE! - APRIL 2009Weekly Picture Me This Round 27 Winner!Weekly Picture Me This Round 41 Winner!Weekly Picture Me This Round 45 Winner!
22nd April, 2006 at 13:57:48 -

Hello Flexxx, welcome to the community.

An easy way to do this is using the INI object, you can simply save and load the location of an object with it. Another way of doing it is using a global value. Set the value to 1 when you enter level 2, and when you are back in level 1 and value is 1, set him to the right position. Hope that makes sense.

 
www.hayovanreek.nl

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
22nd April, 2006 at 14:17:14 -

i solved that problem by using a global value.


if you have just started the game the value will be 0
you change it's value when you exit the house to 1


make a few events that say
start of level and global value 1 = 0 (set position to centre)
start of level and global value 1 = 1 (set position to outside house)

 
.

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
22nd April, 2006 at 14:29:20 -

Yes, use global values instead.

Here's the complete code for it:

------------------

Level 1:

*Start of level
*Global value A is 0
-Player: set position to (The center somewhere)

*Start of level
*Global value A is 1
-Player: set position to (Outside house)

*Start of level
-Set global value A to 0

Level 2:

*Start of level
-Set global value A to 1

--------------

Make sure you have the events that set the global value AFTER the events that check the value of it, since TGF reads from the top downwards, so it will read those events first.

Happy coding!

Image Edited by the Author.

 
n/a

Rydenio



Registered
  19/04/2006
Points
  42
22nd April, 2006 at 17:22:06 -

Thank you all for the help, especially the last poster who gave a full description, wouldnt have been able to do without it. Thanks for taking the time with me, I'm sure I'll beback with silly questions a few more times.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click