SpaceStation1 map updates, ground character template, FIXED THE AI ANGLE DETECTION FINALLY
This commit is contained in:
parent
453a0963b4
commit
8ce7c43009
13 changed files with 258 additions and 195 deletions
|
|
@ -10,9 +10,6 @@
|
||||||
[ext_resource type="Texture2D" uid="uid://5iimabvyld40" path="res://textures/particles/basic.png" id="7_nenq2"]
|
[ext_resource type="Texture2D" uid="uid://5iimabvyld40" path="res://textures/particles/basic.png" id="7_nenq2"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bpe67g6185n5v" path="res://textures/particles/fire.png" id="9_ipns3"]
|
[ext_resource type="Texture2D" uid="uid://bpe67g6185n5v" path="res://textures/particles/fire.png" id="9_ipns3"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_uwrxv"]
|
|
||||||
radius = 16.0
|
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_lnu2h"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_lnu2h"]
|
||||||
radius = 20.0
|
radius = 20.0
|
||||||
|
|
||||||
|
|
@ -38,6 +35,9 @@ scale_max = 0.25
|
||||||
alpha_curve = SubResource("CurveTexture_8qclf")
|
alpha_curve = SubResource("CurveTexture_8qclf")
|
||||||
collision_use_scale = true
|
collision_use_scale = true
|
||||||
|
|
||||||
|
[sub_resource type="ConvexPolygonShape2D" id="ConvexPolygonShape2D_ipns3"]
|
||||||
|
points = PackedVector2Array(-16, 16, 16, 16, 0, -16)
|
||||||
|
|
||||||
[node name="Enemy" type="RigidBody2D"]
|
[node name="Enemy" type="RigidBody2D"]
|
||||||
linear_damp = 6.247
|
linear_damp = 6.247
|
||||||
script = ExtResource("1_xwavj")
|
script = ExtResource("1_xwavj")
|
||||||
|
|
@ -66,9 +66,6 @@ stream = ExtResource("5_ipns3")
|
||||||
[node name="Sprite" type="Sprite2D" parent="."]
|
[node name="Sprite" type="Sprite2D" parent="."]
|
||||||
texture = ExtResource("6_w8i8w")
|
texture = ExtResource("6_w8i8w")
|
||||||
|
|
||||||
[node name="CollisionShape" type="CollisionShape2D" parent="."]
|
|
||||||
shape = SubResource("CircleShape2D_uwrxv")
|
|
||||||
|
|
||||||
[node name="Hitbox" type="Area2D" parent="."]
|
[node name="Hitbox" type="Area2D" parent="."]
|
||||||
|
|
||||||
[node name="Large" type="CollisionShape2D" parent="Hitbox"]
|
[node name="Large" type="CollisionShape2D" parent="Hitbox"]
|
||||||
|
|
@ -102,4 +99,7 @@ one_shot = true
|
||||||
explosiveness = 1.0
|
explosiveness = 1.0
|
||||||
process_material = SubResource("ParticleProcessMaterial_w8i8w")
|
process_material = SubResource("ParticleProcessMaterial_w8i8w")
|
||||||
|
|
||||||
|
[node name="CollisionShape" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("ConvexPolygonShape2D_ipns3")
|
||||||
|
|
||||||
[connection signal="body_shape_entered" from="Hitbox" to="." method="_on_hitbox_body_shape_entered"]
|
[connection signal="body_shape_entered" from="Hitbox" to="." method="_on_hitbox_body_shape_entered"]
|
||||||
|
|
|
||||||
|
|
@ -437,6 +437,7 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
color = Color(1, 1, 1, 0)
|
color = Color(1, 1, 1, 0)
|
||||||
|
|
||||||
|
[connection signal="tree_exiting" from="." to="." method="_on_tree_exiting"]
|
||||||
[connection signal="area_entered" from="Orbits/SpaceStation1/SpaceStation1/EnterHitbox" to="Orbits/SpaceStation1/SpaceStation1" method="_on_enter_hitbox_area_entered"]
|
[connection signal="area_entered" from="Orbits/SpaceStation1/SpaceStation1/EnterHitbox" to="Orbits/SpaceStation1/SpaceStation1" method="_on_enter_hitbox_area_entered"]
|
||||||
[connection signal="body_entered" from="Orbits/SpaceStation1/SpaceStation1/EnterHitbox" to="Orbits/SpaceStation1/SpaceStation1" method="_on_enter_hitbox_body_entered"]
|
[connection signal="body_entered" from="Orbits/SpaceStation1/SpaceStation1/EnterHitbox" to="Orbits/SpaceStation1/SpaceStation1" method="_on_enter_hitbox_body_entered"]
|
||||||
[connection signal="body_shape_entered" from="Player/Hitbox" to="Player" method="_on_hitbox_body_shape_entered"]
|
[connection signal="body_shape_entered" from="Player/Hitbox" to="Player" method="_on_hitbox_body_shape_entered"]
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,6 @@ script = ExtResource("3_8gbjj")
|
||||||
[node name="Sprite" type="AnimatedSprite2D" parent="PlayerGround"]
|
[node name="Sprite" type="AnimatedSprite2D" parent="PlayerGround"]
|
||||||
scale = Vector2(2, 2)
|
scale = Vector2(2, 2)
|
||||||
sprite_frames = SubResource("SpriteFrames_aergo")
|
sprite_frames = SubResource("SpriteFrames_aergo")
|
||||||
animation = &"walk"
|
|
||||||
frame_progress = 0.122260205
|
|
||||||
|
|
||||||
[node name="Camera" type="Camera2D" parent="PlayerGround"]
|
[node name="Camera" type="Camera2D" parent="PlayerGround"]
|
||||||
position_smoothing_enabled = true
|
position_smoothing_enabled = true
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
31
scripts/character_ground.gd
Normal file
31
scripts/character_ground.gd
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
var horizontial_movement = 0
|
||||||
|
var vertical_movement = 0
|
||||||
|
var speed = 256
|
||||||
|
|
||||||
|
## Is the player busy in an interaction?
|
||||||
|
var busy = false
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
$Sprite.play()
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
if busy:
|
||||||
|
velocity = Vector2()
|
||||||
|
else:
|
||||||
|
velocity = Vector2(speed * horizontial_movement, speed * vertical_movement)
|
||||||
|
if horizontial_movement > 0.1:
|
||||||
|
$Sprite.scale.x = -2
|
||||||
|
if horizontial_movement < -0.1:
|
||||||
|
$Sprite.scale.x = 2
|
||||||
|
|
||||||
|
if velocity.length() > 8:
|
||||||
|
$Sprite.animation = "walk"
|
||||||
|
if abs(horizontial_movement) > abs(vertical_movement): $Sprite.speed_scale = abs(horizontial_movement)
|
||||||
|
else: $Sprite.speed_scale = abs(vertical_movement)
|
||||||
|
else:
|
||||||
|
$Sprite.animation = "idle"
|
||||||
|
|
||||||
|
|
||||||
|
move_and_slide()
|
||||||
1
scripts/character_ground.gd.uid
Normal file
1
scripts/character_ground.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cpmmqs6sx078k
|
||||||
|
|
@ -177,11 +177,16 @@ func _process(delta: float) -> void:
|
||||||
var direction = (player.position - position).normalized()
|
var direction = (player.position - position).normalized()
|
||||||
|
|
||||||
# Optionally, you can get the angle if needed
|
# Optionally, you can get the angle if needed
|
||||||
var angle = direction.angle() + deg_to_rad(90)
|
var angle = Vector2.UP.rotated(rotation) # assuming facing right is forward
|
||||||
|
var to_a = (player.global_position - global_position).normalized()
|
||||||
|
|
||||||
var angular_target = wrapf(angle - rotation, -PI, PI)
|
var angle_between = angle.angle_to(to_a)
|
||||||
|
|
||||||
if abs(rad_to_deg(angle - angular_target)) < 25:
|
# Define your field of view angle (in degrees), e.g., 45 degrees cone
|
||||||
|
var fov_degrees = 45
|
||||||
|
var fov_radians = deg_to_rad(fov_degrees / 2)
|
||||||
|
|
||||||
|
if (abs(angle_between) <= fov_radians) or front_cast == player:
|
||||||
if player_distance > 480: boost_pressed = true
|
if player_distance > 480: boost_pressed = true
|
||||||
|
|
||||||
firing = true
|
firing = true
|
||||||
|
|
|
||||||
|
|
@ -160,3 +160,8 @@ func _input(event: InputEvent) -> void:
|
||||||
$UI/Control/PauseMenu/Panel/Flow/Resume.grab_focus()
|
$UI/Control/PauseMenu/Panel/Flow/Resume.grab_focus()
|
||||||
|
|
||||||
get_tree().paused = true
|
get_tree().paused = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_tree_exiting() -> void:
|
||||||
|
LimboConsole.unregister_command(ship_health)
|
||||||
|
LimboConsole.unregister_command(summon_enemy)
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ var default_stats = {
|
||||||
"location": "space",
|
"location": "space",
|
||||||
"ship_position": Vector2(),
|
"ship_position": Vector2(),
|
||||||
"ship_rotation": 0,
|
"ship_rotation": 0,
|
||||||
"story_progress": 0,
|
"story_progress": 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
var stats = default_stats.duplicate_deep()
|
var stats = default_stats.duplicate_deep()
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,7 @@
|
||||||
extends CharacterBody2D
|
extends "res://scripts/character_ground.gd"
|
||||||
|
|
||||||
## Is the player busy in an interaction?
|
|
||||||
var busy = false
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
$Sprite.play()
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
var horizontial_movement = Input.get_axis("ground_left", "ground_right")
|
super(delta)
|
||||||
var vertical_movement = Input.get_axis("ground_up", "ground_down")
|
|
||||||
|
|
||||||
if busy:
|
horizontial_movement = Input.get_axis("ground_left", "ground_right")
|
||||||
velocity = Vector2()
|
vertical_movement = Input.get_axis("ground_up", "ground_down")
|
||||||
else:
|
|
||||||
velocity = Vector2(256 * horizontial_movement, 256 * vertical_movement)
|
|
||||||
if horizontial_movement > 0.1:
|
|
||||||
$Sprite.scale.x = -2
|
|
||||||
if horizontial_movement < -0.1:
|
|
||||||
$Sprite.scale.x = 2
|
|
||||||
|
|
||||||
if velocity.length() > 8:
|
|
||||||
$Sprite.animation = "walk"
|
|
||||||
if abs(horizontial_movement) > abs(vertical_movement): $Sprite.speed_scale = abs(horizontial_movement)
|
|
||||||
else: $Sprite.speed_scale = abs(vertical_movement)
|
|
||||||
else:
|
|
||||||
$Sprite.animation = "idle"
|
|
||||||
|
|
||||||
|
|
||||||
move_and_slide()
|
|
||||||
|
|
|
||||||
33
scripts/player_ground_v2.gd
Normal file
33
scripts/player_ground_v2.gd
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
## Is the player busy in an interaction?
|
||||||
|
var busy = false
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
$Sprite.play()
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
if "_process_2" in self: _process_2(delta)
|
||||||
|
|
||||||
|
var horizontial_movement = Input.get_axis("ground_left", "ground_right")
|
||||||
|
var vertical_movement = Input.get_axis("ground_up", "ground_down")
|
||||||
|
|
||||||
|
if busy:
|
||||||
|
velocity = Vector2()
|
||||||
|
else:
|
||||||
|
velocity = Vector2(256 * horizontial_movement, 256 * vertical_movement)
|
||||||
|
|
||||||
|
if horizontial_movement > 0.1:
|
||||||
|
$Sprite.scale.x = -2
|
||||||
|
if horizontial_movement < -0.1:
|
||||||
|
$Sprite.scale.x = 2
|
||||||
|
|
||||||
|
if velocity.length() > 8:
|
||||||
|
$Sprite.animation = "walk"
|
||||||
|
if abs(horizontial_movement) > abs(vertical_movement): $Sprite.speed_scale = abs(horizontial_movement)
|
||||||
|
else: $Sprite.speed_scale = abs(vertical_movement)
|
||||||
|
else:
|
||||||
|
$Sprite.animation = "idle"
|
||||||
|
|
||||||
|
|
||||||
|
move_and_slide()
|
||||||
1
scripts/player_ground_v2.gd.uid
Normal file
1
scripts/player_ground_v2.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://b6xubbxfsaqby
|
||||||
|
|
@ -112,7 +112,7 @@ func _ground_ready() -> void:
|
||||||
|
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|
||||||
while i < 50:
|
while i < 35:
|
||||||
await get_tree().create_timer(0.2).timeout
|
await get_tree().create_timer(0.2).timeout
|
||||||
|
|
||||||
game.set_vignette_parameter("softness", i * 0.04)
|
game.set_vignette_parameter("softness", i * 0.04)
|
||||||
|
|
@ -178,7 +178,7 @@ func _ground_ready() -> void:
|
||||||
|
|
||||||
await game.dialogue("So, what's next?", "player_slow")
|
await game.dialogue("So, what's next?", "player_slow")
|
||||||
|
|
||||||
await game.dialogue("Well, we're going to give you a minute to fully regain conciousness.", "doctor_1")
|
await game.dialogue("Well, we're going to give you a minute to fully regain your abilities.", "doctor_1")
|
||||||
|
|
||||||
await game.dialogue("Then we'll make sure you're fit to leave.", "doctor_1")
|
await game.dialogue("Then we'll make sure you're fit to leave.", "doctor_1")
|
||||||
|
|
||||||
|
|
@ -187,3 +187,14 @@ func _ground_ready() -> void:
|
||||||
await game.dialogue("Feel free to get up and walk around, by the way.", "doctor_1")
|
await game.dialogue("Feel free to get up and walk around, by the way.", "doctor_1")
|
||||||
|
|
||||||
await game.dialogue("When you're feeling ready, I'll be at the end of the hall.", "doctor_1")
|
await game.dialogue("When you're feeling ready, I'll be at the end of the hall.", "doctor_1")
|
||||||
|
|
||||||
|
global.stats.story_progress = 1
|
||||||
|
|
||||||
|
player.busy = false
|
||||||
|
|
||||||
|
while i < 100:
|
||||||
|
await get_tree().create_timer(0.2).timeout
|
||||||
|
|
||||||
|
game.set_vignette_parameter("softness", i * 0.04)
|
||||||
|
|
||||||
|
i += 2
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue