issue with collision detecting in kinematicbody2d with multiple sprites/shapes

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mdswamp

Hi everyone… I’ve begun using Godot engine recently. I try to create a fighting game. somehow i managed collision between two kinematicbody2d by using separate sprites/shapes. now i have another problem, it seems when kinematicbody2d stops moving and i press hitting buttons, area2d does not detect any collision. this is my script for moving and detecting collision for kinematicbody2d (player1). Any help would be greatly appreciated :slight_smile:

p.s: im using Godot2D v2.1.5 official

    extends KinematicBody2D

const speed = 600
var velocity = Vector2()
onready var sprite0 = get_node("Idle")
onready var sprite1 = get_node("RightFist")
onready var sprite2 = get_node("LeftFist")
onready var sprite3 = get_node("Hurt")
onready var shape0 = get_node("IdleShape")
onready var shape1 = get_node("RightFistShape")
onready var shape2 = get_node("LeftFistShape")

func _ready():
     set_fixed_process(true)

func _fixed_process(delta):
     velocity = Vector2()

     if Input.is_key_pressed(KEY_PERIOD):
        sprite1.show()
        shape1.set_trigger ( false )
        sprite0.hide()
        sprite2.hide()
        sprite3.hide()
        shape0.set_trigger ( true )
        shape2.set_trigger ( true )
        
     elif Input.is_key_pressed(KEY_COLON):
        sprite2.show()
        shape2.set_trigger ( false )
        sprite0.hide()
        sprite1.hide()
        sprite3.hide()
        shape0.set_trigger ( true )
        shape1.set_trigger ( true )
        
     else:
        sprite0.show()
        shape0.set_trigger ( false )
        sprite1.hide()
        sprite2.hide()
        sprite3.hide()
        shape1.set_trigger ( true )
        shape2.set_trigger ( true )

     if Input.is_action_pressed("ui_right"):
        velocity.x += 1
     if Input.is_action_pressed("ui_left"):
        velocity.x -= 1
     if Input.is_action_pressed("ui_down"):
        velocity.y += 1
     if Input.is_action_pressed("ui_up"):
        velocity.y -= 1
     if velocity.length() > 0:
        velocity = velocity.normalized() * speed

     var motion = move(velocity * delta)
     if (is_colliding()):
        var n = get_collision_normal()
        motion = n.slide(motion)
        velocity = n.slide(velocity)
        move(motion)

func _on_Head02_body_enter( body ):
     shape0.set_trigger ( false )
     shape1.set_trigger ( true )
     shape2.set_trigger ( true )
     if (Input.is_key_pressed(KEY_PERIOD) || Input.is_key_pressed(KEY_COLON)):
        print(get_name())