What's the best way to organize an (Alchemy) type game?

Get help using Construct 2

Post » Thu Apr 10, 2014 5:35 am

I have the basic concept down, seems pretty easy. When two items combine they are consumed and disappear. Where I run in to an issue is the shear amount of actions I'm creating to reach the number of combinations I'd like to have.

Does anyone know a better way to do this? Families or something?

Thank you,
B
12
S
4
G
2
Posts: 132
Reputation: 1,749

Post » Thu Apr 10, 2014 5:40 am

I've included a link below for the mechanic I'm trying to achieve (and organize).

http://littlealchemy.com/
B
12
S
4
G
2
Posts: 132
Reputation: 1,749

Post » Thu Apr 10, 2014 5:58 am

I hope i got you right:

Put all your "elements" in a family.
Add instance variable "id" for the family and give each element an id.
Then you need a config to check what new element you'll get.

You can either save it manually in an array (X axis would be the element id, Y Axis the element id of the element you combined and Z the result).
In this cases I like to create my own "Config" Plugin where I save all the data in a JSON Object and return it as JSON String to C2 when needed. (normally I use Hash Plugin to do this, but you could also use an array stucture).
B
14
S
3
G
1
Posts: 255
Reputation: 2,027

Post » Thu Apr 10, 2014 1:28 pm

I agree, an array with all the items you've made would be best, and as for creating the items, you may need to have to have a large volume of code due to the nature of the game sadly.
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,701

Post » Thu Apr 10, 2014 5:08 pm

I was afraid it would be as complicated as I imagined. I'd hoped that I was just overlooking something simple. This would be an amazing game mechanic to combine with an RPG for crafting or something but it might just be over my head right now.
B
12
S
4
G
2
Posts: 132
Reputation: 1,749

Post » Tue Apr 22, 2014 11:08 am

Hey fun thing, I actually made this game. :)

I haven't tried to recreate this in construct but I don't think it would be a problematic thing to do.

I have a json file with all connections, something that looks more less like that:

Code: Select all

{
   "6":{
      "parents":[
         [
            3,
            2
         ]
      ]
   },
   "8":{
      "parents":[
         [
            6,
            3
         ]
      ]
   },
   "9":{
      "parents":[
         [
            1,
            1
         ]
      ]
   },
   "13":{
      "parents":[
         [
            1,
            4
         ],
         [
            15,
            1
         ]
      ]
   },


All elements have a family variable with their id. Then use drag and drop to detect mixing and just go through the list to check if this pair exists in the library.

As mentioned by Vuuv you could format this data so it fits the array or you can try using xml instead.

Then for the progress I store pairs of parents and I go through it the same way when I load or reload the library.

edit:
You could also try using this: plugin-json-import-export-generate-edit-inspect_t100042
B
50
S
15
G
8
Posts: 8
Reputation: 6,428


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests