Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Saving a game character / inventory
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Talion




PostPosted: Wed Jan 18, 2006 7:07 pm   Post subject: Saving a game character / inventory

Alright I was wondering how do you save your game? Like my game uses a record to store the info atm.

How would I save my characters stats and such so that if I close the game I could reopen it and use them again? Would I try using get/put sort of thing? I don't really know how to save any help?

Also, Inventory. in my game there are 50 items. with each battle won you have a 50% chance of getting an item. Now how would I store these items in an inventory? Would I use the same method as I would saving a character? Or what?

Just wondering. I'd just look in the tutorials but I have no idea where to look.
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Wed Jan 18, 2006 7:21 pm   Post subject: (No subject)

You could use put/get, but since you're using records, it's much easier to use read/write. It will read/write entire records for you at once. I'm not sure if we've got a tutorial covering this, actually. Glance at our File I/O tutorials, and check the Turing Help file; it shouldn't be too difficult. Note that you're data files won't be readable.

As for inventory, you could keep an array of Items. But what is an Item? You'll want to look into for an answer to that Inheritence and Polymorphism.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: