SpaceStation1 map updates, ground character template, FIXED THE AI ANGLE DETECTION FINALLY

This commit is contained in:
ToasterPanic 2025-12-06 15:28:33 -05:00
parent 453a0963b4
commit 8ce7c43009
13 changed files with 258 additions and 195 deletions

View file

@ -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"]

View file

@ -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"]

View file

@ -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

View 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()

View file

@ -0,0 +1 @@
uid://cpmmqs6sx078k

View file

@ -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)
# 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(rad_to_deg(angle - angular_target)) < 25: 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

View file

@ -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)

View file

@ -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()

View file

@ -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()

View 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()

View file

@ -0,0 +1 @@
uid://b6xubbxfsaqby

View file

@ -17,173 +17,184 @@ func _ground_ready() -> void:
player.position = game.get_node("PlayerSpawnIntro").global_position player.position = game.get_node("PlayerSpawnIntro").global_position
player.busy = true player.busy = true
await get_tree().create_timer(0.5).timeout
await game.dialogue("ugh...", "player_woozy", false)
await get_tree().create_timer(1).timeout
game.end_dialogue()
"""var i = 0
while i < 5:
await get_tree().create_timer(0.2).timeout
game.set_vignette_parameter("softness", i * 0.02)
i += 1
while i > 0:
await get_tree().create_timer(0.2).timeout
game.set_vignette_parameter("softness", i * 0.02)
i -= 1
await game.dialogue("Is he concious..?", "doctor_1", false)
await get_tree().create_timer(2).timeout
await game.dialogue("Franky, I doubt it. You know the recovery rates.", "doctor_2", false)
await get_tree().create_timer(1.5).timeout
await game.dialogue("Monitor's probably just bugging out, per the usual...", "doctor_2", false)
var choice_1 = await game.make_choice({
"what": "...what..?",
"huh": "...huh..?",
"whhngh": "...whhngh..."
})
if choice_1 == "what":
await game.dialogue("...what...", "player_woozy", false)
elif choice_1 == "huh":
await game.dialogue("...huh..?", "player_woozy", false)
elif choice_1 == "whhngh":
await game.dialogue("...whhngh...", "player_woozy", false)
await game.dialogue("Wait... can you hear me?", "doctor_2", false)
var choice_2 = await game.make_choice({
"yeah": "...yeah..?",
"yeah2": "...yea..."
})
if choice_2 == "yeah":
await game.dialogue("...yeah..?", "player_woozy", false)
elif choice_2 == "yeah2":
await game.dialogue("...yea...", "player_woozy", false)
await get_tree().create_timer(0.5).timeout
while i < 5:
await get_tree().create_timer(0.2).timeout
game.set_vignette_parameter("softness", i * 0.02)
i += 1
await game.dialogue("Woah, that's...", "doctor_1", false)
while i < 10:
await get_tree().create_timer(0.2).timeout
game.set_vignette_parameter("softness", i * 0.02)
i += 1
await get_tree().create_timer(1.5).timeout
await game.dialogue("...well, what do we do now?", "doctor_2", false)
await get_tree().create_timer(2).timeout
await game.dialogue("I can handle it if you want.", "doctor_1", false)
await get_tree().create_timer(1.5).timeout
await game.dialogue("Well, if you need any help, ping me.", "doctor_2", false)
await get_tree().create_timer(1).timeout
await game.dialogue("Don't worry, I won't.", "doctor_1", false)"""
var i = 0
while i < 50:
await get_tree().create_timer(0.2).timeout
game.set_vignette_parameter("softness", i * 0.04)
i += 2
var choice_3 = await game.make_choice({
"where_am_i": "...where am I?",
"who_are_you": "...who are you?"
})
if choice_3 == "where_am_i":
await game.dialogue("...where am I..?", "player_slow", false)
await get_tree().create_timer(0.5).timeout
elif choice_3 == "who_are_you":
await game.dialogue("...who are you..?", "player_slow", false)
await get_tree().create_timer(0.5).timeout await get_tree().create_timer(0.5).timeout
await game.dialogue("Well, I'm Doctor Hohm.", "doctor_1") await game.dialogue("ugh...", "player_woozy", false)
await game.dialogue("You're currently in the Rosenhein Memorial Intergalatic Hospital.", "doctor_1") await get_tree().create_timer(1).timeout
await game.dialogue("You've been in a... coma-like state for the past four weeks.", "doctor_1") game.end_dialogue()
"""var i = 0
var choice_4 = null while i < 5:
await get_tree().create_timer(0.2).timeout
while choice_4 != "whats_next":
choice_4 = await game.make_choice({ game.set_vignette_parameter("softness", i * 0.02)
"space": "I'm in space...?",
"coma": "Coma...?", i += 1
"whats_next": "What's next...?",
while i > 0:
await get_tree().create_timer(0.2).timeout
game.set_vignette_parameter("softness", i * 0.02)
i -= 1
await game.dialogue("Is he concious..?", "doctor_1", false)
await get_tree().create_timer(2).timeout
await game.dialogue("Franky, I doubt it. You know the recovery rates.", "doctor_2", false)
await get_tree().create_timer(1.5).timeout
await game.dialogue("Monitor's probably just bugging out, per the usual...", "doctor_2", false)
var choice_1 = await game.make_choice({
"what": "...what..?",
"huh": "...huh..?",
"whhngh": "...whhngh..."
}) })
print(choice_4) if choice_1 == "what":
await game.dialogue("...what...", "player_woozy", false)
elif choice_1 == "huh":
await game.dialogue("...huh..?", "player_woozy", false)
elif choice_1 == "whhngh":
await game.dialogue("...whhngh...", "player_woozy", false)
await game.dialogue("Wait... can you hear me?", "doctor_2", false)
if choice_4 == "space": var choice_2 = await game.make_choice({
await game.dialogue("Hold on... intergalactic... I'm in space?", "player_slow", false) "yeah": "...yeah..?",
"yeah2": "...yea..."
})
if choice_2 == "yeah":
await game.dialogue("...yeah..?", "player_woozy", false)
elif choice_2 == "yeah2":
await game.dialogue("...yea...", "player_woozy", false)
await get_tree().create_timer(0.5).timeout
while i < 5:
await get_tree().create_timer(0.2).timeout
game.set_vignette_parameter("softness", i * 0.02)
i += 1
await game.dialogue("Woah, that's...", "doctor_1", false)
while i < 10:
await get_tree().create_timer(0.2).timeout
game.set_vignette_parameter("softness", i * 0.02)
i += 1
await get_tree().create_timer(1.5).timeout
await game.dialogue("...well, what do we do now?", "doctor_2", false)
await get_tree().create_timer(2).timeout
await game.dialogue("I can handle it if you want.", "doctor_1", false)
await get_tree().create_timer(1.5).timeout
await game.dialogue("Well, if you need any help, ping me.", "doctor_2", false)
await get_tree().create_timer(1).timeout
await game.dialogue("Don't worry, I won't.", "doctor_1", false)"""
var i = 0
while i < 35:
await get_tree().create_timer(0.2).timeout
game.set_vignette_parameter("softness", i * 0.04)
i += 2
var choice_3 = await game.make_choice({
"where_am_i": "...where am I?",
"who_are_you": "...who are you?"
})
if choice_3 == "where_am_i":
await game.dialogue("...where am I..?", "player_slow", false)
await get_tree().create_timer(0.5).timeout
elif choice_3 == "who_are_you":
await game.dialogue("...who are you..?", "player_slow", false)
await get_tree().create_timer(0.5).timeout await get_tree().create_timer(0.5).timeout
await game.dialogue("Yes, you're in space.", "doctor_1") await game.dialogue("Well, I'm Doctor Hohm.", "doctor_1")
await game.dialogue("...how the hell did I get here?", "player_slow") await game.dialogue("You're currently in the Rosenhein Memorial Intergalatic Hospital.", "doctor_1")
await game.dialogue("Well, I don't know..", "doctor_1") await game.dialogue("You've been in a... coma-like state for the past four weeks.", "doctor_1")
await game.dialogue("The story is that you collapsed trying to buy a pack of Twizzlers at the Galacta store.", "doctor_1")
await game.dialogue("Thankfully, we're right next to the Galacta store.", "doctor_1")
elif choice_4 == "coma": var choice_4 = null
await game.dialogue("A coma..?", "player_slow", false)
while choice_4 != "whats_next":
choice_4 = await game.make_choice({
"space": "I'm in space...?",
"coma": "Coma...?",
"whats_next": "What's next...?",
})
await get_tree().create_timer(0.5).timeout print(choice_4)
await game.dialogue("Well, it's not actually a coma.", "doctor_1") if choice_4 == "space":
await game.dialogue("Hold on... intergalactic... I'm in space?", "player_slow", false)
await get_tree().create_timer(0.5).timeout
await game.dialogue("Yes, you're in space.", "doctor_1")
await game.dialogue("...how the hell did I get here?", "player_slow")
await game.dialogue("Well, I don't know..", "doctor_1")
await game.dialogue("The story is that you collapsed trying to buy a pack of Twizzlers at the Galacta store.", "doctor_1")
await game.dialogue("Thankfully, we're right next to the Galacta store.", "doctor_1")
elif choice_4 == "coma":
await game.dialogue("A coma..?", "player_slow", false)
await get_tree().create_timer(0.5).timeout
await game.dialogue("Well, it's not actually a coma.", "doctor_1")
await game.dialogue("It's called Intergalactic Processing Disorder.", "doctor_1")
await game.dialogue("People with certain genetics are prone to have that happen under extreme, prolonged stress.", "doctor_1")
await game.dialogue("Most people don't wake up again. You got lucky.", "doctor_1")
await game.dialogue("So, what's next?", "player_slow")
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("Once that's done, you'll be discharged.", "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")
global.stats.story_progress = 1
player.busy = false
while i < 100:
await get_tree().create_timer(0.2).timeout
await game.dialogue("It's called Intergalactic Processing Disorder.", "doctor_1") game.set_vignette_parameter("softness", i * 0.04)
await game.dialogue("People with certain genetics are prone to have that happen under extreme, prolonged stress.", "doctor_1") i += 2
await game.dialogue("Most people don't wake up again. You got lucky.", "doctor_1")
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("Then we'll make sure you're fit to leave.", "doctor_1")
await game.dialogue("Once that's done, you'll be discharged.", "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")