PositionToTileX & PositionToTileY redundancy?

Discussion and feedback on Construct 2

Post » Thu Oct 02, 2014 4:31 am

I've noticed PositionToTileX & PositionToTileY seem to return the same value no matter what. Is this a redundancy? Is there any reason for both expressions? Am I missing something?

I saw this bug report: viewtopic.php?f=152&t=95705&p=739097&hilit=positiontotilex#p739097

But it seems to have been kind of overlooked since the OP sorta had the usage confused.

EDIT: Here's a capx
postotile.capx
You do not have the required permissions to view the files attached to this post.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Thu Oct 02, 2014 5:14 am

tilemap.PositionToTileX(mouse.x) & " | " & tilemap.positiontotileY(mouse.y)
ImageImageImage
B
71
S
21
G
220
Posts: 3,648
Reputation: 123,725

Post » Thu Oct 02, 2014 5:30 am

blackhornet wrote:tilemap.PositionToTileX(mouse.x) & " | " & tilemap.positiontotileY(mouse.y)


??
I set them both to x and both to y to show they're the same. you can set one to x and the other to y and then reverse it. still the same..

I don't get it?
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Thu Oct 02, 2014 5:42 am

okay. I moved my tilemap from 0,0 and got different returning values..
But if anyone can explain this to me, I've got my head all muddled up trying to figure it out, heh..
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Thu Oct 02, 2014 5:53 am

The tiles are on a grid. tilemap.PositionToTileX(mouse.x) gets the Column, and tilemap.positiontotileY(mouse.y) gets the Row.
So 0,0 is the first tile 1,0 is the next tile to the right, 0,1 is the tile below 0,0. Like a spreadsheet or an array.
ImageImageImage
B
71
S
21
G
220
Posts: 3,648
Reputation: 123,725

Post » Thu Oct 02, 2014 6:13 am

@blackhornet Thanks. I realize that.

Anyhow, I get it now. I guess I was just having a hard time seeing why they were returning the same values. Gets kinda heavy and multidimensional to think about with both mouse values and both tile values.. Sleep might help.. G'night!
B
86
S
43
G
71
Posts: 601
Reputation: 43,619


Return to Construct 2 General

Who is online

Users browsing this forum: Hiran Rodrigues and 5 guests