The Daily Click ::. Forums ::. Klik Coding Help ::. Saving position and information created building
 

Post Reply  Post Oekaki 
 

Posted By Message

NessyTheBritishlad



Registered
  14/03/2014 19:30:51
Points
  2
14th March, 2014 at 14/03/2014 20:41:42 -

I want to make a sim kinda game where you are looking after a little civilisation of people and you build houses and other buildings. But not sure how once multiple of the same the building has been built to save where it has been placed and save any info for each one. So you can quit and come back later

I could do if there was one buy idk with multiple. Thank you

 
n/a

nivram



Registered
  20/07/2006
Points
  171
15th March, 2014 at 15/03/2014 12:43:38 -

Use the INI or Array Objects to save and load.

Marv

 
458 MMF2 & CTF 2.5 examples and games

http://www.castles-of-britain.com/mmf2examples.htm

NessyTheBritishlad



Registered
  14/03/2014 19:30:51
Points
  2
15th March, 2014 at 15/03/2014 13:02:10 -

I know how to with one active object. But if I am using lots of the same active object. But I want them to have different values and positions saved to each one.

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
18th March, 2014 at 18/03/2014 03:37:35 -

It depends on how you want to store the data.
INI would be the easiest I think.

Assign an ID to each building type:

0-House
1-Farm
2-Kitten Factory

Then when the user places a building you could store it's ID and position data in an ini file.

So your ini would look sorta like this:

[buildings]
0=0,200,200
1=0,200,220
2=1,50,30

So that would be two Houses one at 200x200 and one at 200x220 then a Farm at 50x30.
You'll also need the string parser object to parse the data.

Anyway I know I left a lot of details out, but perhaps that'll get you on the right path.

 
n/a

Jenswa

Possibly Insane

Registered
  26/08/2002
Points
  2723
22nd March, 2014 at 22/03/2014 12:54:23 -

UrbanMonk is right. You can also look up the concept of tilemaps if you don't want to use 2D coordinates.

The problem with (a multiple of the same) active objects in KNP/TGF/MMF is: you don't know to which one you are referring unless something happens with that object. For instance: there is a collision with the active or someone clicks on it. Of course there are some ways around this problem.

Also your game would be very similar to a level editor.

Happy coding,
Jenswa

 
Image jenswa.neocities.org
   

Post Reply



 



Advertisement

Worth A Click