How do I store away and bring out objects created?

0 favourites
  • 9 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • 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.

  • 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.

  • 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?

  • I made a little example:

    dl.dropboxusercontent.com/u/14855413/ex.capx

  • I cant access what you've linked me :/

  • Herald of Time

    Just copy-paste the link on the browser.

    (I don't have enough rep to post "clickable" links)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

  • You can use the asJSON expression : https://www.scirra.com/manual/133/common-expressions

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)