Cannot manipulate object created in function

Bugs will be moved here once resolved.

Post » Wed Mar 06, 2013 3:12 am

Link to .capx file (required!):
https://www.dropbox.com/s/tureayltmsnowuj/bugIssue.capx?m

Steps to reproduce:
1. Generate object in function
2. Choose newly created object as last event in function
3. In that last event, manipulate new object

Observed result:
Objects spawn without being rotated


Expected result:
The new object is rotated


Browsers affected:
Chrome: yes

Operating system & service pack:
Windows 7

Construct 2 version:
r121
    
B
20
S
10
G
4
Posts: 106
Reputation: 4,219

Post » Sat Mar 09, 2013 8:06 am

I wanted to post the same :)



I really appreciate to know just if this is possible to be fixed to continue my project using function for this application

I think its not a bug because you can avoid this just by a wait 0.01 sec ... a tick

if you ccall a function for create or spawnn instance the new instance need one refresh to be modified



thanks in advance egos2013-03-09 08:06:52
B
14
S
3
G
3
Posts: 30
Reputation: 3,435

Post » Wed Mar 13, 2013 2:40 pm

This is by design, a sort of known limitation. Created objects don't really exist until the next top-level event. You can use them in the same event, but not in later subevents. This is for stability reasons (the game can crash if objects are immediately created, due to the architecture of the engine). The workaround is to copy the initialisation actions in to each event that creates the object.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Wed Mar 13, 2013 5:36 pm

@ashley Ah, Ok. I was wondering if I'd have to go with that, it seemed rather inefficient but if it alternative is a less stable engine, I'll take inefficent! Thanks for the help

@egos that sounds like a good workaround, i'll give it a shot
B
20
S
10
G
4
Posts: 106
Reputation: 4,219


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 3 guests