Just Dzhi 2023-09-30 23:57:58 +04:00
parent f54e70173c
commit 3a4b647df5
3 changed files with 16 additions and 13 deletions

View File

@ -8,16 +8,6 @@
config_version=4
_global_script_classes=[ {
"base": "EditorVCSInterface",
"class": "GitAPI",
"language": "NativeScript",
"path": "res://addons/godot-git-plugin/git_api.gdns"
} ]
_global_script_class_icons={
"GitAPI": ""
}
[application]
config/name="LD54"
@ -48,7 +38,7 @@ version_control_plugin_name="GitAPI"
[gdnative]
singletons=[ "res://addons/godot-git-plugin/git_api.gdnlib" ]
singletons=[ ]
[global]

View File

@ -12,6 +12,15 @@ func _physics_process(_delta):
velocity.y = speed * sin(get_angle_to(Vector2($"../Player".global_position.x + 7, $"../Player".global_position.y + 8)))
else:
velocity = Vector2.ZERO
if abs($"../Player".velocity.x) > 0 and position.distance_to(Vector2($"../Player".global_position.x, $"../Player".global_position.y)) < 48:
velocity.x = speed * 2 * cos(get_angle_to(Vector2($"../Player".global_position.x + 8, $"../Player".global_position.y + 8)) + 180)
velocity.y = speed * 2 * sin(get_angle_to(Vector2($"../Player".global_position.x + 8, $"../Player".global_position.y + 8)) + 180)
if position.distance_to(Vector2($"../Player".global_position.x, $"../Player".global_position.y)) < 32:
velocity.x = speed * 2 * cos(get_angle_to(Vector2($"../Player".global_position.x + 8, $"../Player".global_position.y + 8)) + 180)
velocity.y = speed * 2 * sin(get_angle_to(Vector2($"../Player".global_position.x + 8, $"../Player".global_position.y + 8)) + 180)
move_and_slide(velocity)

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=2]
[gd_scene load_steps=18 format=2]
[ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1]
[ext_resource path="res://src/scenes/game/sprites/background_houses.png" type="Texture" id=2]
@ -12,6 +12,7 @@
[ext_resource path="res://icon.png" type="Texture" id=10]
[ext_resource path="res://src/scenes/game/game.gd" type="Script" id=11]
[ext_resource path="res://src/scenes/game/sprites/ui_background.png" type="Texture" id=12]
[ext_resource path="res://src/models/enemies/bat/Bat.tscn" type="PackedScene" id=13]
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 10, 60 )
@ -69,6 +70,9 @@ shape = SubResource( 3 )
[node name="Player" parent="View" instance=ExtResource( 5 )]
position = Vector2( 46, 42 )
[node name="Bat" parent="View" instance=ExtResource( 13 )]
position = Vector2( 87, 40 )
[node name="UI" type="Control" parent="."]
margin_right = 40.0
margin_bottom = 40.0