Some kind of "data base"

For questions about using Classic.

Post » Sun Oct 30, 2011 1:28 pm

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 :3Vladoss2011-10-30 13:30:00
B
38
S
15
G
6
Posts: 238
Reputation: 7,760

Post » Sun Oct 30, 2011 4:10 pm

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')
    
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Sun Oct 30, 2011 5:42 pm

[QUOTE=Davioware] 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')
    [/QUOTE]

I also have array wich using id var to create blocks on load, so i think there will be problem with your way.Vladoss2011-10-30 17:43:03
B
38
S
15
G
6
Posts: 238
Reputation: 7,760

Post » Mon Oct 31, 2011 8:23 am

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
B
38
S
15
G
6
Posts: 238
Reputation: 7,760


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest