Skip to content

Commit

Permalink
fix: offscreen indicator labels, fix leaf quest
Browse files Browse the repository at this point in the history
Drops a dead robot script, and adds offscreen indicators to bosses.
  • Loading branch information
russmatney committed May 28, 2024
1 parent 193907e commit 9267b5e
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 190 deletions.
2 changes: 1 addition & 1 deletion src/components/offscreen_indicator/OffscreenIndicator.gd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static func add(node, opts={}):
return

var indicator = indicator_scene.instantiate()
indicator.ready.connect(indicator.set_label_text.bind(opts.get("label")))
indicator.ready.connect(indicator.set_label_text.bind(opts.get("label", node.name)))

var vis = VisibleOnScreenNotifier2D.new()
vis.screen_exited.connect(OffscreenIndicator.maybe_activate.bind(indicator, node, opts))
Expand Down
2 changes: 2 additions & 0 deletions src/components/offscreen_indicator/OffscreenIndicator.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ offset_bottom = 14.0
rotation = -0.785398
pivot_offset = Vector2(40, 8)
theme_override_fonts/normal_font = ExtResource("3_f56n0")
theme_override_font_sizes/normal_font_size = 16
bbcode_enabled = true
text = "[center]sheep"
fit_content = true
scroll_active = false
autowrap_mode = 0
custom_effects = [ExtResource("4_5k2rg"), ExtResource("5_vk1dt"), ExtResource("6_na7en")]
4 changes: 4 additions & 0 deletions src/dino/bosses/SSBoss.gd
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ func _ready():

state_label.set_visible(false)

OffscreenIndicator.add(self, {
# could instead depend on a fn like this directly on the passed node
is_active=func(): return not is_dead})

func calculate_warp_spots():
var dist_away = 200
var maybe_targets = [
Expand Down
180 changes: 0 additions & 180 deletions src/dino/enemies/robots/Robot.gd

This file was deleted.

5 changes: 1 addition & 4 deletions src/dino/entities/targets/Target.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ var is_dead = false

func _ready():
anim.animation_finished.connect(_animation_finished)
OffscreenIndicator.add(self)
# TODO how to work with animations and positions after regen bug
# U.animate(self)
# U.animate_rotate(self)
OffscreenIndicator.add(self, {label="Target"})
area_entered.connect(_on_body_entered)
body_entered.connect(_on_body_entered)

Expand Down
2 changes: 1 addition & 1 deletion src/dino/entities/targets/Target.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=5 format=3 uid="uid://c4inidtgbuwlg"]
[gd_scene load_steps=4 format=3 uid="uid://c4inidtgbuwlg"]

[ext_resource type="Script" path="res://src/dino/entities/targets/Target.gd" id="1_7124b"]
[ext_resource type="SpriteFrames" uid="uid://d1uqrh57tjmm6" path="res://src/dino/entities/targets/target_sprite_frames.tres" id="2_c7m12"]
Expand Down
5 changes: 3 additions & 2 deletions src/dino/pickups/leaves/LeafEntity.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extends WoodsEntity
func all_anims() -> Array:
return [anim_green, anim_greenred, anim_purple, anim_redorange, anim_yellow]

signal caught
signal caught(leaf)
var is_caught = false

var anim
Expand All @@ -23,6 +23,7 @@ func _ready():
anim = U.rand_of(all_anims())
super._ready()
render()
OffscreenIndicator.add(self, {label="Leaf"})

func hide_anims():
all_anims().map(func(a):
Expand All @@ -40,7 +41,7 @@ func render():

func kill():
is_caught = true
caught.emit()
caught.emit(self)
animate_collected()

func animate_collected():
Expand Down
4 changes: 2 additions & 2 deletions src/dino/vania/VaniaGame.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[ext_resource type="Script" path="res://src/dino/vania/VaniaGame.gd" id="1_rrc8s"]
[ext_resource type="Script" path="res://addons/phantom_camera/scripts/phantom_camera_host/phantom_camera_host.gd" id="2_ae8tp"]
[ext_resource type="Resource" uid="uid://x22mhotva8q3" path="res://src/dino/modes/runner/mapdefs/Tower.tres" id="2_u5nad"]
[ext_resource type="Resource" uid="uid://4ee51xr80oda" path="res://src/dino/modes/runner/mapdefs/Woods.tres" id="2_p5qke"]
[ext_resource type="PackedScene" uid="uid://sisqkgg1lwpf" path="res://src/dino/hud/DinoHUD.tscn" id="5_r75pq"]
[ext_resource type="PackedScene" uid="uid://dch8dyylb7526" path="res://addons/MetroidvaniaSystem/Template/Nodes/Minimap.tscn" id="6_jluxu"]
[ext_resource type="PackedScene" uid="uid://dq1rff2gu3q68" path="res://src/dino/menus/controls/ActionInputIcon.tscn" id="8_g3klb"]
Expand Down Expand Up @@ -34,7 +34,7 @@ shader_parameter/grayscale = 0.0

[node name="VaniaGame" type="Node2D" groups=["vania_game"]]
script = ExtResource("1_rrc8s")
map_def = ExtResource("2_u5nad")
map_def = ExtResource("2_p5qke")

[node name="Camera2D" type="Camera2D" parent="."]
ignore_rotation = false
Expand Down

0 comments on commit 9267b5e

Please sign in to comment.