im trying to make this land placer work i think it doesn’t like the func _physics_process but it told me to write it that way when i was making that part of it initially so i dont know i need help im still new
var hit = RayCast2D_is_colliding():
Called when the node enters the scene tree for the first time.
func _physics_process(_delta: float) → void :
var random = randi_range(0,3)
var _here = get_viewport()
if RayCast2D_is_colliding():
print (true)
else :
if random < 0:
var _land = Vector2i(0,0)
print(0)
set_cell(_here, 0, _land)
elif random < 1:
var _land = Vector2i(1,0)
print(1)
set_cell(_here, 0, _land)
elif random < 2:
var _land = Vector2i(2,0)
print(2)
set_cell(_here, 0, _land)
elif random < 3:
var _land = Vector2i(3,0)
print(3)
set_cell(_here, 0, _land)
Do you have a function named RayCast2D_is_colliding? For a variable definition you do not need the colon at the end, only for control-flow like if or funcs
Does this line (without the colon) give you a different error?
yea i put ray cast inside of the world node but i had a feeling that wasn’t communicating that to it is there something i need to connect im signaling it with draw but i dont know if thats working either
i dont have anything yet i made several scripts in tutorials and am trying to string the principals of them together to do what i need
trying to make stepping into a void spawn one of my tiles
like i have one for world2d and one for raycast i tried having this code in either but one says i cant use setcell and the other says i cant use raycast collision
I think you want the raycast to get the tilemaplayer by collision
if is_colliding():
var collider := get_collider()
if collider is TileMapLayer:
var collision_point := get_collision_point()
# need to do some coversion that I am not familiar with.
collider.set_cell(collision_point, 0, _land)
no that wont really work for me since I’m trying to use collision in the reverse way like thats only able to get a position from a hit which is a place i dont need a block