fixs
This commit is contained in:
@@ -68,4 +68,10 @@ func _on_body_entered(body: Node) -> void:
|
||||
GameController.emit_signal("point_gain", type)
|
||||
split()
|
||||
elif body is Ship and !body.is_inv():
|
||||
GameController.emit_signal("player_hit")
|
||||
body.is_currently_hit = true
|
||||
#GameController.emit_signal("player_hit")
|
||||
|
||||
|
||||
func _on_body_exited(body: Node) -> void:
|
||||
if body is Ship:
|
||||
body.is_currently_hit = false
|
||||
|
||||
@@ -11,11 +11,10 @@ func _on_item_list_item_selected(index: int) -> void:
|
||||
|
||||
func _on_item_list_item_activated(index: int) -> void:
|
||||
var temp = $Control/ItemList.get_item_text(index)
|
||||
print(temp)
|
||||
var nbr = player_name.length()
|
||||
if temp == "Back":
|
||||
player_name[-1] = ""
|
||||
elif temp == "Enter":
|
||||
elif temp == "Enter" and player_name.length() > 0:
|
||||
GameController.emit_signal("go_to_menu", player_name)
|
||||
elif nbr < 10:
|
||||
player_name += temp
|
||||
|
||||
@@ -6,6 +6,7 @@ class_name Ship
|
||||
@export var SHOOT_NODE: PackedScene
|
||||
@export var TIME_INVUL := 1.0
|
||||
@export var animation : AnimationPlayer
|
||||
@export var target : Node2D
|
||||
|
||||
const SPEED = 25.0
|
||||
const JUMP_VELOCITY = -400.0
|
||||
@@ -17,6 +18,7 @@ var rota_temp: float
|
||||
var delay := 0.0
|
||||
var is_in = true
|
||||
var delay_inv := 0.0
|
||||
var is_currently_hit := false
|
||||
|
||||
func _input(event):
|
||||
pass
|
||||
@@ -47,19 +49,22 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
if horizontal != 0 or vertical != 0:
|
||||
direction = Vector2(vertical, horizontal)
|
||||
rotation = atan2(horizontal, vertical)
|
||||
rotation = rotate_toward(rotation ,atan2(horizontal, vertical), 0.5)
|
||||
|
||||
|
||||
if Input.is_action_pressed("ui_accept") and delay >= 0.5:
|
||||
shoot()
|
||||
delay = 0
|
||||
|
||||
if !is_inv() and is_currently_hit:
|
||||
GameController.emit_signal("player_hit")
|
||||
|
||||
move_and_slide()
|
||||
|
||||
|
||||
func shoot()->void:
|
||||
var new = SHOOT_NODE.instantiate()
|
||||
new.direction = direction
|
||||
new.position = position + (32 * direction.normalized())
|
||||
new.direction = (target.global_position - global_position).normalized()
|
||||
new.position = target.global_position
|
||||
get_parent().add_child(new)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user