Tileset source_id is used to complete the switch of scene pictures, spring, summer, autumn and winter

I need some help. At present, I am able to switch between the four seasons through the method in tilemap.

	change_item(Vector2i(15,22),Vector2i(15,10))
	change_item(Vector2i(12,22),Vector2i(12,10))

func change_item(first_pos:Vector2i,second_pos:Vector2i,layer:int = 1,source_id:int = 1):
	var items = season.get_used_cells_by_id(layer,source_id,first_pos)
	items.map(func(item): season.set_cell(layer,item,source_id,second_pos))
	pass

I find this to be too inefficient, although it can achieve the end result. I hope to complete the four seasons rotation by switching between png images in tileset. But I didn’t find it in the documentation, how to switch tileset png image in the code by source_id

is this what you are looking for?

the video shown switching between 4 images

1 Like

yes, yes. I found what I needed in it, tile_set.get_source(0).texture = xxx. Thank you very much. I’ll get back to my game

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.