[HOW TO] Creating the right sprite inside family

Get help using Construct 2

Post » Sun May 06, 2012 7:28 am

Hey

I've got a question.. can I create a specific sprite inside a family using system create object and selecting the family as object???

I'm trying that for a few time and to be honest I have no idea if it's possible..

I thought that adding some condition that specify a sprite inside the family would solve the problem but it just creates random sprites from the family when the object is created.

Any ideas??


here's a simple capx:
http://dl.dropbox.com/u/71080256/testing.capx
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Sun May 06, 2012 8:50 am

Why not just select the object you want to create instead of the family?

Edit: if you're trying to create an object by its name, use a series of subevents, e.g.

if name = "obj1", create sprite1
if name = "obj2", create sprite 2
...etcAshley2012-05-06 08:51:52
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Sun May 06, 2012 11:50 am

@Ashley
If I were to create a level editor, I would probably put all the game object in a family "gameObjects" and I would appreciate to be able to browse an array of indexes and do something like

[code]Global cols = 10
Global rows = 10
Global cellSize = 32
+System: for "" from 0 to cols*rows-1
Local x = 0
Local y = 0
-> System: Set x to loopindex%cols
-> System: Set y to floor(loopindex/cols)
-> System: Create gameObjects[Array.At(x,y)] on Layer "Game" at (x*cellSize,y*cellSize)[/code]

using in short family[id] to access a specific member of a family.
It would then be also interesting to be able to sort the members or assign specific ID in a family to keep consistency if I were to add gameObject to my level editor.

For now the only way to achieve the same result is to make an event per gameObject which is a bit ugly :D
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sun May 06, 2012 4:40 pm

[QUOTE=Ashley] Why not just select the object you want to create instead of the family?

Edit: if you're trying to create an object by its name, use a series of subevents, e.g.

if name = "obj1", create sprite1
if name = "obj2", create sprite 2
...etc[/QUOTE]

I'm sorry, but this isn't the solution that I'm looking for, my intention is optimize the gamecode. Imagine if in the family there's 100 sprites, would have to add 100 events just like the one you mentioned.

You say: Why not just select the object you want to create instead of the family?
Then I say: Why not with families?

As Yann mentioned, for game level editors and many other things, this will be very helpful if it's possible.
In construct 1 I can do what Yann mentioned. Can't Construct 2 be able to do that too?

I've also made many suggestions on another topic that the only purpose is to make the Construct2 tool more powerful in the issue of expanding the possibilities of game creation.

Please understand that I'm just giving new ideas for C2 that are already possible to do in Construct1.

If these things will in the future be implemented in C2 then it's okay, I know that take time and also there's priorities sometimes.

ps:sorry for my english ;)
B
30
S
6
G
5
Posts: 433
Reputation: 6,061


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, Yahoo [Bot] and 19 guests