Some kind of "data base"

This forum is currently in read-only mode.
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • In my project i have 2 types of objects.

    1 is blocks

    2 is inventory items

    each of them have "id" var.

    block "wood" (id 2) item "inv_wood (id 2)" and etc.

    And to tie them I had to make "big" event with all of their "id's"

    image 1

    image 2

    Is there a way to make sure that the system itself staring id of both objects and select the desired

    For example:

    On "Items" Drop ->

    ?"Items" [id] = "Blocks" [id] -> Create object "Blocks" at x y

    I hope you understand me :3

  • If you had made all your inventory objects the same object, but with different animation frames, you could have done:

    On click on blocks,

        create INV_OBJECT

        set anim frame to block('id')

    and the same with your drop function. Since you made them all different objects though, Now you can rename them to inv1 inv2 inv3 etc. and use create object by name;

    On click on blocks,

        create by name "inv"&block('id')

  • If you had made all your inventory objects the same object, but with different animation frames, you could have done:

    On click on blocks,

        create INV_OBJECT

        set anim frame to block('id')

    and the same with your drop function. Since you made them all different objects though, Now you can rename them to inv1 inv2 inv3 etc. and use create object by name;

    On click on blocks,

        create by name "inv"&block('id')

        

    I also have array wich using id var to create blocks on load, so i think there will be problem with your way.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So yeah i did it. I made an array where are stored all the id and object names. And when you drop item or pick block system using this array to create the desired object.

    image 1

    image 2

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)