Tiles Triggering Actions
I want to do a check to see if the player is in a certain tile.
How would I check? For this example, I just want to use the top left tile (1x1) PHP Code:
|
PHP Code:
PHP Code:
Quote:
|
Quote:
Do you think you could use it in an example for me, I'm having trouble understanding.. I was never good at tile stuff. I'm using this for the check but I get errors. I guess I'm not using it in right context.. PHP Code:
|
temp.playerTiletype = tiles[player.x + 1.5, player.y + 2]; is just defining a temporary variable as whatever is returned by tiles[player.x + 1.5, player.y + 2], which will be unset once the current function process ends
all you need to do is: PHP Code:
|
Quote:
error: unexpected symbol x1 at line 68: if (tiles[player.x + 1.5, player.y + 2] == 1x1) { Don't think the check you gave me is correct.. |
i didnt realise graal doesnt like using 1x1 directly like that, i usually change the tile values to their actual hexadecimal value, in this case 17:
PHP Code:
|
Quote:
1. Nothing is happening when I collide with the tile... Not sure if I'm missing something. 2. How did you come up with 17 for 1x1 tile? |
i just realised that the first tile should be 0x0 rather than 1x1 as mentioned in your first post, 1x1 probably isnt even valid
should definitely work if you do: PHP Code:
PHP Code:
PHP Code:
|
Quote:
Yay it works :) But can you explain how you did get 17 though? How do I calculate what tiles are equal to what value? |
there are plenty of online tools that can do it, for example:
http://www.binaryhexconverter.com/he...imal-converter 0x would unambiguously state that the following value is hexadecimal and the number before the x represents a count of 16s before it, so 1x1 is basically 16 + 1, 2x1 is 32 + 1 aka 33, 2xF is 32 + 15 aka 47 etc whereas if you used the true hexadecimal value for 17 which is '11' that would appear more ambiguous |
Quote:
I really appreciate the help ;) But I have one more question to add to this What can I do so I don't have to do this.. PHP Code:
|
PHP Code:
|
Quote:
on created PHP Code:
PHP Code:
|
PHP Code:
|
Quote:
I'm having trouble figuring out the value for each tile. I used the calculator to figure out what this tile it: Location: Farthest to the left. Second from the top Possible Formulas: 2xa, ax2, 1xb, bx1 I put all these in calculator and none of the values are detecting |
All times are GMT +2. The time now is 12:11 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.