extends CharacterBody2D
var SPEED = 300.0
var vel : float
func _physics_process(delta):
move_local_x(vel * SPEED * delta)
func _on_area_2d_area_entered(area):
var areas = $Area2D.get_overlapping_areas()
print(area.get_groups())
for i in areas:
if area.is_in_group("Enemy"):
area.hit()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter