Skip to content

Commit

Permalink
fix:make fight.tscn work
Browse files Browse the repository at this point in the history
  • Loading branch information
limuy2022 committed Jun 30, 2024
1 parent 33f0e28 commit c520bf1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
8 changes: 6 additions & 2 deletions gdrust/src/fight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,12 @@ impl Fight {
fn check_sword(&self) {
for i in get_fight_list() {
let obj = self.base().get_node_as::<Node>(*i);
assert!(obj.has_method(START.into()), "**{}**", *i);
assert!(obj.has_signal(ATTACK_FINISHED.into()), "**{}**", *i);
assert!(obj.has_method(START.into()), "**{}** misses start", *i);
assert!(
obj.has_signal(ATTACK_FINISHED.into()),
"**{}** misses attack finished",
*i
);
}
}

Expand Down
3 changes: 0 additions & 3 deletions gdrust/src/weapons/star_wrath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ impl StarWrath {
anmi.play_ex().name("enter_scene".into()).done();
}

#[signal]
fn attack_finished() {}

#[func]
fn fall_star(&mut self) {
let bullet = self.get_bullet_scene();
Expand Down
2 changes: 1 addition & 1 deletion scripts/weapons/star_wrath.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func _process(_delta: float) -> void:

func next_operation():
if operation_idx >= operations.size():
attack_finished.emit()
$"..".attack_finished.emit()
return
operations[operation_idx].call()
operation_idx += 1
6 changes: 6 additions & 0 deletions scripts/weapons/star_wrath_root.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
extends Node

signal attack_finished


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
Expand All @@ -9,6 +11,10 @@ func _ready() -> void:
$StarWrath.hide()


func start():
$StarWrath.start()


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta: float) -> void:
pass

0 comments on commit c520bf1

Please sign in to comment.