function create object

Discussion and feedback on Construct 2

Post » Sat Mar 09, 2013 8:37 am

Hello

The question as been asked in the bug section but i think its not a bug so i ask the question here

If you create instance with a call function you cant change or use property of the new instance into the same event

Or (and its why i think its not a bug ) you just need to wait 1 tick to interact with the new instance in the same event


I just need to know if this can be change in the futur


thanks in advance
B
14
S
3
G
3
Posts: 30
Reputation: 3,435

Post » Sat Mar 09, 2013 3:26 pm

I'd like to see this changed, it's very fiddly to use and can really cause problems. But it was explained by Ashley in another post that this was a necessary change for stability reasons. Hopefully in the future a better solution will be found because it really is awkward and a major stumbling block the first time you come across it.
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Mon Mar 11, 2013 12:52 am

Hum

i hope it will be possible .
This just force to me to keep instance evry time and so increase the number of sprites
B
14
S
3
G
3
Posts: 30
Reputation: 3,435

Post » Mon Mar 11, 2013 2:26 am

It's pretty heavily ingrained into C2 that newly created objects can't be picked until the next top level event. Because functions don't keep the scope of your working objects you have to repick it - thereby dashing any hopes of accessing the created object.

Maybe Ashley can do something like give functions the option of keeping the scope of the calling method - that way the object wouldn't have to be repicked and you could still modify it. It's a bit of a longshot though.

B
24
S
4
G
1
Posts: 244
Reputation: 3,462


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 10 guests