SOLVED How do I change tilemap image at runtime?

Get help using Construct 2

Post » Mon Sep 07, 2015 3:24 am

I'm trying to figure out a way (if at all possible) to change the image that the tilemap uses while the game is running?I know that I can load the image for the tilemap from a URL but as far as I can tell that's the only way. Is it possible to use this function to load the image from Construct 2 itself? I do realize there are alternatives to handling what I need done(essentially switching from a good tilemap to an evil tilemap) but I'd like to avoid having to overlap and handle two separate maps at the same time.
Last edited by gskunk on Wed Sep 30, 2015 9:46 pm, edited 1 time in total.
B
4
Posts: 5
Reputation: 214

Post » Mon Sep 07, 2015 8:57 am

+1

I am curious too!

All I could do to copy the tilemap and change the iamge of it and put it under the original and I switched the visibility of the original to achive soemthing like that. But this solution is unconfortable, bad, ugly and I am sure doing these on all of my layouts are wasting a lot of resource.
B
10
S
2
G
1
Posts: 51
Reputation: 761

Post » Mon Sep 07, 2015 11:20 am

something like this ?

https://goo.gl/dhP9qi
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Mon Sep 07, 2015 12:31 pm

You can add an image file to the "Files" folder in C2 (for example "new_tiles.png") and then use "Tilemap: Load image from url" and just use a name of that image file

-> Tilemap: Load image from "new_tiles.png"
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,599
Reputation: 34,825

Post » Mon Sep 07, 2015 10:28 pm

RamPackWobble: Not quite, I'm looking to change the image the tilemap is pulling tiles from. Switching tiles I don't have an issue with. I could use your method to just shift all the tiles down however many I need to the other set if I put it in the same image, but I'm worried about performance issues of constantly changing tiles like that when I'm using a tileswitch to animate tiles.

shinkan: I'm going to continue poking at this to see if I can get it to work but of right now I can't get it to load the image.
B
4
Posts: 5
Reputation: 214

Post » Mon Sep 07, 2015 10:38 pm

shinkan: Thank you immensely. For some reason I wasn't thinking and was manually placing the image in the files folder instead of loading it through construct. Works perfect!
B
4
Posts: 5
Reputation: 214

Post » Wed Sep 09, 2015 11:09 am

sound great guys, thank you!
B
10
S
2
G
1
Posts: 51
Reputation: 761


Return to How do I....?

Who is online

Users browsing this forum: amazingdream, lordsas, mekonbekon and 52 guests