Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TileMap::set_cell does not perform transformation in non-square modes #49452

Closed
Chaosus opened this issue Jun 9, 2021 · 2 comments
Closed

TileMap::set_cell does not perform transformation in non-square modes #49452

Chaosus opened this issue Jun 9, 2021 · 2 comments
Labels
Milestone

Comments

@Chaosus
Copy link
Member

Chaosus commented Jun 9, 2021

Godot version

4.0 dev (090e4c4)

System information

Windows 10

Issue description

A similar code in 3.2 brings a different result in 4.0:

Godot 3.2
func create_selection(from : Vector2, to : Vector2):
	  var begin_x = int(min(from.x, to.x))
	  var end_x = int(max(from.x, to.x))
	  
	  var begin_y = int(min(from.y, to.y))
	  var end_y = int(max(from.y, to.y))
	  
	  for x in range(begin_x, end_x+1, 1):
	  	for y in range(begin_y, end_y+1, 1):
	  		tilemap.set_cell(x, y, 0)

Result:
tilemap_test3 2

Godot 4.0
func create_selection(from : Vector2i, to : Vector2i):
	  var begin_x = mini(from.x, to.x)
	  var end_x = maxi(from.x, to.x)
	  
	  var begin_y = mini(from.y, to.y)
	  var end_y = maxi(from.y, to.y)
	  
	  for x in range(begin_x, end_x+1):
	  	for y in range(begin_y, end_y+1):
	  		tilemap.set_cell(Vector2i(x, y), 0, Vector2i(0, 0), 0)

Result:
tilemap_test4 0

Steps to reproduce

Simply run provided projects and compare.

Minimal reproduction project

@Chaosus Chaosus added this to the 4.0 milestone Jun 9, 2021
@Chaosus
Copy link
Member Author

Chaosus commented Jun 9, 2021

Ah, seems I need to activate Diamond Down TileLayout. Sorry, false alarm.

@groud
Copy link
Member

groud commented Jun 9, 2021

Yep, the TileLayout property modifies how tiles are indexed in the TileMap. So well, this behavior is intended :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants