File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
dodge-the-creeps/rust/src Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -23,12 +23,14 @@ pub struct Main {
2323impl INode for Main {
2424 fn init ( base : Base < Node > ) -> Self {
2525 // We could also initialize those manually inside ready(), but OnReady automatically defers initialization.
26+ // Alternatively to init(), you can use #[init(...)] on the struct fields.
2627 Self {
27- mob_scene : OnReady :: new ( || load ( "res://Mob.tscn" ) ) ,
28- player : OnReady :: node ( "Player" ) ,
29- hud : OnReady :: node ( "Hud" ) ,
30- music : OnReady :: node ( "Music" ) ,
31- death_sound : OnReady :: node ( "DeathSound" ) ,
28+ // OnReady::from_loaded(path) == OnReady::new(|| tools::load(path)).
29+ mob_scene : OnReady :: from_loaded ( "res://Mob.tscn" ) ,
30+ player : OnReady :: from_node ( "Player" ) ,
31+ hud : OnReady :: from_node ( "Hud" ) ,
32+ music : OnReady :: from_node ( "Music" ) ,
33+ death_sound : OnReady :: from_node ( "DeathSound" ) ,
3234 score : 0 ,
3335 base,
3436 }
You can’t perform that action at this time.
0 commit comments