Load new TILESET into a tilemap object, how?.

  • Hello, I have a tilemap object with its set of tiles.

    I would like to know if I can load a new set of tiles on that object and how should I do it ?.

    I do not want two different tilemap objects, I want to use the same object and for that I need to change their tiles according to the level the player plays.

    -----------------------------------

    In another case, why can not I access the width and height of the TILESET loaded in the tilemap object?

  • When you create an object, any actions below that refer to that object, so maybe if you do something like:

    Start of layout ->

    create object Tilemap

    load tilemap

    create another object tilemap

    load second tilemap

    It should work. If you want better control over it you can just pick which tilemap you mean using IIDs. Something like:

    Start of level->

    Pick tilemap where tilemap.IID = 0 ->

    Load tilemap1

    Pick tilemap where tilemap.IID = 1 ->

    Load tilemap2

  • When you create an object, any actions below that refer to that object, so maybe if you do something like:

    Start of layout ->

    create object Tilemap

    load tilemap

    create another object tilemap

    load second tilemap

    It should work. If you want better control over it you can just pick which tilemap you mean using IIDs. Something like:

    Start of level->

    Pick tilemap where tilemap.IID = 0 ->

    Load tilemap1

    Pick tilemap where tilemap.IID = 1 ->

    Load tilemap2

    I'm not sure I understand this, I just want to load a new TILESET (NOT TILEMAP) into a tilemap object.

    Then I do not understand ... what would help me what you say ?.

  • You can load an image from url into the tilemap, but you can't have 2 instances of the same object with a different image, so 1 image per tilemap object.

  • You can load an image from url into the tilemap, but you can't have 2 instances of the same object with a different image, so 1 image per tilemap object.

    I understand but I think there is a bit of confusion, in DOC says this:

    Load image from URL

    Load a new tilemap image from a given URL. It is not used until the image has finished downloading, and On image URL loaded triggers. Images loaded from different domains are subject to the same cross-domain restrictions as AJAX requests - for more information see the section on cross-domain in the AJAX object. Data URIs can also be passed as an image, e.g. from a canvas snapshot or webcam image.

    In DOC talks about loading a TILEMAP image, but does not say anything about TILESET, the TILESET is the set of tiles that you will use to build the map with the tilemap object.

    I want to load a new TILESET in my TILEMAP object.

    I understand that you can not have two equal objects with different TILESETS.

    That's not a problem for me because I'm just going to have a single tilemap object.

    I want to change the TILESET of my tilemap object at runtime.

    But there is no action that is "Load new tileset" on the tilemap object.

    Load image from URL I think it only loads a new map for your tilemap object, but it does not load a new TILESET for the object.

    Maybe I'm wrong but I think it's not possible to load a new TILESET into a tilemap object, in fact, you can not access the properties (width and height) of the TILESET image loaded in a tilemap object.

  • Oh, you can just save it to json and then load from json.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh, you can just save it to json and then load from json.

    Yes, that is true but only the TILEMAP, you can not load a new TILESET in any way.

  • Edit: Sorry lol I just read your post from before and my assumptions were wrong.

  • I think I understand what you want, but you cannot do that.

    You want 2 instances of the same tilemap object to have a complete set of different images in them, right?

    That's impossible. The minute you change the tile images, all instances of that object will have the new images. Instances are just a copy of the object that are allowed to have different variable values, like height and such, but not images.

    TILESET can not be changed.

    Even if you only have one tilemap object.

    It can not.

    I only have one tilemap object, I do not need any more tilemap objects and I can not change their tileset.

  • What C2 is calling "a new tilemap image" is indeed a tileset.

    Here's an example of how you load different tilesets:

    https://www.dropbox.com/s/us4peovqb1btm ... .capx?dl=0

    Each tileset is a separate image. You can check them in the Files folder in the Project Tree.

    Edit: Keep in mind that changing the tile width/height in runtime is impossible, though.

  • What C2 is calling "a new tilemap image" is indeed a tileset.

    Here's an example of how you load different tilesets:

    https://www.dropbox.com/s/us4peovqb1btm ... .capx?dl=0

    Each tileset is a separate image. You can check them in the Files folder in the Project Tree.

    Edit: Keep in mind that changing the tile width/height in runtime is impossible, though.

    Perfect, then I was wrong, I simply did not know that function and I thought it was just a map load, not a TILESET, I was also confused that the action is called "Load image from URL". I thought it was about uploading a new map from the network by connecting to a web or some server or something.

    Thanks !, this eliminates some problems in my game.

    On the width and the height, I only need to consult it, I do not need to change it.

    Is it possible to consult the values ?.

    I do not know how to check the width and height of a tileset.

  • You can do that by also having a blank sprite load the tilemap image. Then you can get the sprite's height/width to get those values.

  • You can do that by also having a blank sprite load the tilemap image. Then you can get the sprite's height/width to get those values.

    A strange way to check those values but it seems that there is no other way, thanks again !.

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