How create obj by name?

Get help using Construct 2

Post » Wed Jun 13, 2012 4:08 pm

I really cannot think of a place where 'create object by name' would be useful enough to warrant these security flaws. We have aniamtions and frames - shouldn't this be enough?
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Wed Jun 13, 2012 5:18 pm

im really questioning the likeness someone will reverse engineer, this would be generally hard to do and a good programmer can probably recreate the behavior faster on its own, but keeping this into account i suggested making an object by a variable "name" or something else

using frames is a workaround, at the end of the day you want things collide with objects, with there own set of animations and frames

the whole system is setup around using objects, why make things hard and make it so that whenever you want to reference this object you need to include "is on this frame"

an example would be an editor, where you want the least amount of duplicated objects (for maintenance), you simple make a menu out of the objects, when clicked on the object it creates that object by getting the var name, this with one action for all objects!

not 20 or more create actions, creating that specific object + every object that gets introduced



ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Wed Jun 13, 2012 5:23 pm

This thread is a few months old. Since then a really good workaround has come about: just make a family, add all your objects to it, and add a family instance variable called "name" with text type. Type in all the object names to the instance variable, then you can just use the instance variable to compare the object's name, pick by object name, etc.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,498

Post » Wed Jun 13, 2012 6:50 pm

yesterday i created an example exactly as you describe

tread

but the only thing missing, is that you cant create the object based on this "name" , if this would be possible, you would only need one event and a compare function, to create all objects, there would also be less need for replacing objects in eventsheet

ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Thu Jun 14, 2012 12:00 pm

@Ashley

My following example is a rough prototype for having large layouts on an Android device. The objects are all placed on the layout, placed in an array at the start of layout and deleted and then recalled as you you scroll across the layout. However I also have the same creating objects by name issue as I want a large amount of different object types i.e 100s

https://dl.dropbox.com/u/41218343/LargeLayoutsEXP5.capx

If I could set each instances's animation in the layout editor and also see the chosen animation I could see and plan a layout without using a massive amount of object types and without repeating the code for each object type because it could be done with variables.

It would be like having an object working as if it were a family with limited features and would be really useful, especially for a rich background.

Do you think it would be possible to add a feature to be able to select an initial animation in the editor and to be able to see it?
B
29
S
8
G
4
Posts: 61
Reputation: 6,205

Post » Wed Jul 25, 2012 2:47 am

@vtrix

Perfect example! Thanks, that helped me a tonne.
B
9
Posts: 6
Reputation: 862

Post » Tue Sep 11, 2012 1:04 pm

Creating objects of the certain type on run time is really painful right now: you have to make a particular case for each object type. Please do something with it.

One possible solution could be to be able to pass "object type" to a variable and than use variable to create objects.
B
42
S
11
G
4
Posts: 505
Reputation: 7,267

Post » Mon Feb 25, 2013 8:51 pm

looked at the example... wow, ok, it does work but what a mess. All that so we can avoid the possibility of someone reverse engineering our project!? Man, there just ought to be a better way. I just want a way "create object by name"... from all my searching on the forums and tutorials I guess it's just not possible.

Thanks for taking the time to post an example solution anyway.
B
4
Posts: 5
Reputation: 785

Post » Tue Dec 29, 2015 11:23 pm

Thanks a ton Kyatric for the changing animation instead of object. I had been trying to think of a way to do something for a while and never thought of that...
B
3
Posts: 1
Reputation: 177

Previous

Return to How do I....?

Who is online

Users browsing this forum: christina and 6 guests