can someone help me please
i try to recreate tetris game following this tutorial
https://www.youtube.com/watch?v=fne_uEozW9o&t=140s
but i encounter a problem when the block almost arrive at bottom and i suddenly rotate it, it become over the game area, what should i do to fix it ?
i try to put box collision at bottom, but because the block only using 2dnode and sprite,it's not working(i try to put collision box on block node but it' not working)
is it the problem in my rotate code
func can_rotate(val) -> bool:
if Globals.inactive.has(Vector2(get_parent().position.x+val.x,get_parent().position.y+val.y)) or is_off_screen(Vector2(get_parent().position.x+val.x,get_parent().position.y+val.y)):
return false
else:
return true
func isoffscreen(vec) -> bool:
if vec.x < 0:
return true
elif vec.x >= getparent().getparent().getrect().size.x:
return true
elif vec.y < 0:
return true
elif vec.y >= getparent().getparent().getrect().size.y:
return true
else:
return false
how to change is_off_screen
to sprite size?
https://ibb.co/7RGf7Xr
thank you for your help
