How create a object on a empy layer?

Get help using Construct 2

Post » Mon Oct 08, 2012 8:36 pm

Hello! I need help!
Please some brother can helpme?
Im trying to create a objet into a empy layer by code

On star layout > system create object (select objet, layer and x & y)

But give me a error
I have 8 sprites and i want to create one without draw onto layer by mouse.

Thank you   
B
5
Posts: 12
Reputation: 860

Post » Mon Oct 08, 2012 10:10 pm

Moved to 'How do I?'

What error do you get?
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Mon Oct 08, 2012 10:29 pm

Assertion failure: No default instance when creating object. You must have at least one instance of every object type in at least one layout. This will be fixed in a future build...

Stack trace:
assert2@http://localhost:50000/preview_prelude.js:12
@http://localhost:50000/preview.js:1457
@http://localhost:50000/preview.js:1448
@http://localhost:50000/preview.js:1445
@http://localhost:50000/system.js:552
@http://localhost:50000/eveng.js:996
@http://localhost:50000/eveng.js:502
@http://localhost:50000/eveng.js:477
@http://localhost:50000/eveng.js:1971
@http://localhost:50000/eveng.js:1858
@http://localhost:50000/eveng.js:1827
@http://localhost:50000/preview.js:999
@http://localhost:50000/preview.js:892
@http://localhost:50000/preview.js:949

Thanks!
B
5
Posts: 12
Reputation: 860

Post » Tue Oct 09, 2012 1:14 am

[QUOTE=rafachan] No default instance when creating object. You must have at least one instance of every object type in at least one layout.[/QUOTE]

The error message says it all.

You must create at least one instance (during edittime) for all your object types in one of the layout of your project.
Even if you place the instance outside of the layout and/or destroy it on start of the layout.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Tue Oct 09, 2012 9:29 am

[QUOTE=Kyatric] [QUOTE=rafachan] No default instance when creating object. You must have at least one instance of every object type in at least one layout.[/QUOTE]

The error message says it all.

You must create at least one instance (during edittime) for all your object types in one of the layout of your project.
Even if you place the instance outside of the layout and/or destroy it on start of the layout.[/QUOTE]

Thank you so much for reply, but yet i dont understand. create a instance is take the mouse and draw a sprite into a layout? In that case i have a problem, becouse i have heavy sprites (are character for fighting game) in diferents colours. I must draw everything in a layout? thank you
B
5
Posts: 12
Reputation: 860

Post » Tue Oct 09, 2012 9:46 am

Any sprite in your project needs at least one instance in one of the project's layouts.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Tue Oct 09, 2012 9:56 am

Ok thank you very much Kyatric!
B
5
Posts: 12
Reputation: 860

Post » Tue Oct 09, 2012 9:58 am

Yes you "draw" every sprite you're gonna use in a specific layout, this is by design.

In my opinion this is a design flaw, if the object is in your project you should be able to create it whether or not one already exists. But since I don't know the inner workings of C2 I have no idea of how feasible it is, and I trust Ashley.

Best thing you can do is either create a layer or a family with all the object you had to create, and then use on start of layout -> destroy for every object in the family or layer.

Ninjaed by Kyatric, you sneaky devilKaisirak2012-10-09 09:59:42
B
5
S
1
G
1
Posts: 39
Reputation: 1,128

Post » Tue Oct 09, 2012 1:24 pm

[QUOTE=Kaisirak] Yes you "draw" every sprite you're gonna use in a specific layout, this is by design.

In my opinion this is a design flaw, if the object is in your project you should be able to create it whether or not one already exists. But since I don't know the inner workings of C2 I have no idea of how feasible it is, and I trust Ashley.

Best thing you can do is either create a layer or a family with all the object you had to create, and then use on start of layout -> destroy for every object in the family or layer.

Ninjaed by Kyatric, you sneaky devil[/QUOTE]

Thank you for the info bro! Ill try to destroy sprites for save memory ram, but i think best way is a small update in the engine. :)rafachan2012-10-09 13:25:09
B
5
Posts: 12
Reputation: 860


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests