Page 1 of 2

Jewelry Game

PostPosted: Sat May 08, 2010 6:20 pm
by Scorpion50o1
my jewelry game is back from the dead(from old post)
I got EXE
Could yall help me with save add load on it :O

Re: Jewelry Game

PostPosted: Sat May 08, 2010 7:12 pm
by Thanx
I can look at it... but not now, it's the evening here, I should get sleep, because tomorrow I pack up, and the day after tomorrow I go on a 10 day journey to Italy... Won't be on the forums either... At the moment I don't see the purpose of this game, but the point would be to settle with a maximum number of objects you want, then when saving, you send activation events to all those clones, and in their activation events they should save to an array (two array for each actor type, one for their x positions, the other for their y positions) It saves into the array slot of their cloneindex. Then saves the vars (put them all in a save group, and use the saveVars function to save them.

For loading you loadVars, and you create the different actors one-by-one, and give them the appropriate xpos and ypos read out of the saved arrays... Create a loop, and the loop accesses the clones one-by-one...
sprintf(avariable, "actorname.%i", i);
getclone(avariable)->x = 4;
I think that should work for getting a specific clone's position...
Sorry if it may seem a bit foggy, but just say so. I just wrote this down, because I really wanted to help instantly... :D

Re: Jewelry Game

PostPosted: Sat May 08, 2010 7:35 pm
by Scorpion50o1
For the game the user of it can make unlimited amount of shapes not just a maximum of say 20.

Re: Jewelry Game

PostPosted: Sat May 08, 2010 7:41 pm
by Thanx
In that case you'll need what are called dynamic arrays...
Which means you have to define the variables you want to save yourself
You have to get to know malloc,realloc functions, as well as sizeof.
It'd be hard to explain the whole thing at the moment, because it's tricky coding, and though I know it, I haven't practiced it nearly enough to explain it well. I suggest looking up the functions in searches, as well as dynamic arrays... Look through examples, and then follow a similar approach as I've explained just before.
Then of course you can't save it in groups, so, you'll also need to know how to open a file for reading, writing, and you'll need to know how to save to it, and close it... That's not that easy, and I suggest doing it with text files at the moment, because it's simple. fopen, fclose, fgets, fprintf these are the more important functions to know, again I suggest looking them up, and getting to know them... That's all I can say, because I can't explain it well enough... sorry, but I hope this'll still be helpful! :)

Re: Jewelry Game

PostPosted: Sat May 08, 2010 8:19 pm
by Hblade
Scorpion, saving and loading:



This shows you how to save arrays. Using this you can save ^.^

Re: Jewelry Game

PostPosted: Sat May 08, 2010 8:29 pm
by Scorpion50o1
will this work for clones?

Re: Jewelry Game

PostPosted: Sun May 09, 2010 3:59 pm
by lcl
I'd like to play it, but my computer doesn't support this full screen version, so could you load here also windowed version? :D

Re: Jewelry Game

PostPosted: Sat Jun 12, 2010 10:57 pm
by Scorpion50o1
so Hblade i gotta do that for all the players

Re: Jewelry Game

PostPosted: Sun Jun 13, 2010 1:44 am
by Hblade
It should work for clones :D idk o.o

Re: Jewelry Game

PostPosted: Sun Jun 13, 2010 1:46 am
by Scorpion50o1
havent tested yet but i am working on the game making more "gems"

Re: Jewelry Game

PostPosted: Sun Jun 13, 2010 2:08 am
by Scorpion50o1
k something is wrong when i move the gems and save and reopen it they are all in one spot instead of seperated like i had them

Re: Jewelry Game

PostPosted: Sun Jun 13, 2010 2:22 am
by Hblade
Remember to use the array and use [cloneindex] in draw actor :D (I forgot what the problem was lol)

A cool demo :D

PostPosted: Sun Jun 13, 2010 2:34 am
by Hblade
Heres a demo I hope it helps :D The code is very simple too :3

Re: Jewelry Game

PostPosted: Sun Jun 13, 2010 9:25 pm
by Scorpion50o1
the demo did help but when i start up the game all the things start up at one spot

Re: Jewelry Game

PostPosted: Sun Jun 13, 2010 10:59 pm
by Hblade
idk then sorry :(