#Jump in isometric top down?
1 messages · Page 1 of 1 (latest)
Could you elaborate? Is there a way of checking what tilemaplayer the player is on? I use layers to add height, so the ocean would be on layer 0, beaches on 0 and 1, grass on layers between 1 and say 15, and snow above that. Just an example, havent tweaked it yet.
You can check the player's coordinates and use $TileMapLayer.local_to_map() to see if there's any cells used at that coordinate.
local_to_map() uses local coordinates, you you need to do something like
var cell_pos: Vector2 = $TileMapLayer.local_to_map( to_local(player_node.global_position) )
The issue is that you have to check every single TileMapLayer.
You can use an Area2D or intersect_point() so you can check the cells trough physics.
would a raycast looking down, be able to check for the name of what it is colliding with? if so wouldnt that be a way to check which height level the character is on?
In 2D there is only X and Y
There is no actual height, so you cannot check what is below seomthing. Everything is at the same height.
Raycasts also stop when colliding with anything, so it can only detect 1 tilemap at a time, and if they overlap the result is pretty much random.
Checking tilemap cells always returns the tilemap in question as the object. If you want to know the specific cell, you need to get the collision RID, which most stuff that checks for collision does.
But you DO need something that checks all objects at a given point. Not a raycast which merely stops at the first thing it hits.
Im trying to understand, but this seems to be a bit above my paygrade, so ithink ill have to put this to bed for now, might visit this later tho. thanks for the help