![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | ohpoloha |
Hi community,
I’m completely new to godot. I wanted to build a game similar to Happy Glass (https://play.google.com/store/apps/details?id=com.game5mobile.lineandwater&hl=en_US&gl=US) which player can draw lines on the screen and existing objects would be able to collide/interact with the lines.
I’ve came to the position where I can draw lines on screen now with the script below:
func _input(event):
if event is InputEventMouseButton:
_pressed = event.pressed
if _pressed:
_current_line = Line2D.new()
_lines.add_child(_current_line)
if event is InputEventMouseMotion && _pressed:
_current_line.add_point(event.position)
linePoints.append(event.position)
if event is InputEventMouseButton && !_pressed:
addCollisionShape(linePoints)
linePoints.clear()
However, my other objects are not interacting with the lines. I know I need to add CollisionBody
or something but I can’t figure out how.
Thanks so much