The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

can someone help me please
i try to recreate tetris game following this tutorial

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
    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 >= get
return true
return false

how to change is_off_screen to sprite size?
thank you for your help


Godot version 3.3.2
in Engine by (14 points)
edited by

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.