How do I store away and bring out objects created?

Get help using Construct 2

Post » Thu Oct 22, 2015 11:18 pm

The basic idea of what i'm going for is to do the following:

- Create an object and customize elements of it. (Got this part down)

- Store it away.

- Bring it out again being called by designated name assigned to a key command.

So my questions are:

What is the best way to 'store' objects away? (Do arrays work or is there a different method i should use?)

Can an object stored away be called out by name or would i have to use its UID?

Help would be greatly appreciated. :)
B
10
S
2
Posts: 36
Reputation: 1,274

Post » Fri Oct 23, 2015 4:27 am

If there only a couple of such objects, you can position them off screen so that they cannot be accessed (clicked, trigger accidental collisions, etc) and then recalled and re-positioned by picking them with their UID. You can store their UIDs in a simple array for that.
If there are dozens of them, so that hiding them will probably affect performance, you can do the following:
Using a 2 dimensional array, you can store whichever properties you want for each one of them and when you want to "store" them away, destroy them. When you want to bring any of this objects back, create a new instance and pass it the stored properties.
Note: Don't try to store their UIDs or IIDs with this method. UIDs are gone when you destroy the object and IIDs are shifted. Instead visualize in your head which "row" in the 2d array corresponds to which object.
B
13
S
5
G
1
Posts: 116
Reputation: 1,805

Post » Fri Oct 23, 2015 10:20 am

So i can store more than one set of information in each block of an array? or would i need to have one for each instance variable say, in rows?
B
10
S
2
Posts: 36
Reputation: 1,274

Post » Fri Oct 23, 2015 1:55 pm

I made a little example:

dl.dropboxusercontent.com/u/14855413/ex.capx
B
13
S
5
G
1
Posts: 116
Reputation: 1,805

Post » Sat Oct 24, 2015 2:56 am

I cant access what you've linked me :/
B
10
S
2
Posts: 36
Reputation: 1,274

Post » Sat Oct 24, 2015 8:43 am

@Herald of Time

Just copy-paste the link on the browser.
(I don't have enough rep to post "clickable" links)
B
13
S
5
G
1
Posts: 116
Reputation: 1,805

Post » Sat Oct 24, 2015 1:57 pm

I did and ended up with an error message:

[Fiddler] The socket connection to dl.dropboxusercontent.com failed.
ErrorCode: 10060.
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 108.160.173.133:80
B
10
S
2
Posts: 36
Reputation: 1,274

Post » Sat Oct 24, 2015 3:07 pm

You can use the asJSON expression : https://www.scirra.com/manual/133/common-expressions
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Sat Oct 24, 2015 4:36 pm

Herald of Time wrote:I did and ended up with an error message:

[Fiddler] The socket connection to dl.dropboxusercontent.com failed.
ErrorCode: 10060.
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 108.160.173.133:80


Try this (replacing ** with tt)
h**ps://dl.dropboxusercontent.com/u/14855413/ex.capx
B
13
S
5
G
1
Posts: 116
Reputation: 1,805


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests