Skip to content

Commit d822119

Browse files
committed
add 1th Yarwin guideline:
"We can use the new signal API"
1 parent 1165355 commit d822119

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

squash-the-creeps/godot/main.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[ext_resource type="PackedScene" uid="uid://d0jx5lcbm76jf" path="res://mob.tscn" id="1_h2yge"]
44
[ext_resource type="PackedScene" uid="uid://bvlv4saytitbk" path="res://player.tscn" id="1_ig7tw"]
5-
[ext_resource type="FontFile" uid="uid://dl270v4sovdki" path="res://fonts/Montserrat-Medium.ttf" id="2_0xm2m"]
5+
[ext_resource type="FontFile" uid="uid://dh16egfjxm1lt" path="res://fonts/Montserrat-Medium.ttf" id="2_0xm2m"]
66

77
[sub_resource type="BoxShape3D" id="BoxShape3D_7dm0k"]
88
size = Vector3(60, 2, 60)

squash-the-creeps/godot/mob.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[gd_scene load_steps=5 format=3 uid="uid://d0jx5lcbm76jf"]
22

3-
[ext_resource type="PackedScene" uid="uid://or56hj80wrrn" path="res://art/mob.glb" id="1_dy6sc"]
3+
[ext_resource type="PackedScene" uid="uid://darw1tgj604mn" path="res://art/mob.glb" id="1_dy6sc"]
44

55
[sub_resource type="BoxShape3D" id="BoxShape3D_nokgg"]
66
size = Vector3(1.40546, 1.45325, 1.70323)

squash-the-creeps/rust/src/main_scene.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::mob;
22
use crate::player;
33
use crate::scorelabel;
4+
use crate::scorelabel::UserInterface;
45

56
use godot::classes::{ColorRect, InputEvent, PathFollow3D, Timer};
67
use godot::prelude::*;
@@ -67,7 +68,9 @@ impl MainScene {
6768
self.base_mut().add_child(&mob);
6869

6970
// We connect the mob to the score label to update the score upon squashing a mob.
70-
mob.connect("squashed", &self.user_interface.callable("on_mob_squashed"));
71+
mob.signals()
72+
.squashed()
73+
.connect_other(&*self.user_interface, UserInterface::on_mob_squashed);
7174
}
7275

7376
#[func]

0 commit comments

Comments
 (0)