This partially solves #8. I hadn't seen that sprites were added to the issue, so I ended up using Godot's icon.
Run the scene res://scenes/stages/commander_test/comander_test.tscn with F6 to see it working.
You can move your commander with wasd only for now, but you can't attack, so you'll take a beating from the AI Commander.
After you die, the game stops and prints "Game Over".
I created a player_actor scene that inherits from the actor scene, and uses a script that inherits from the Actor Script, so that I could override the "state machine" related functions and make it player controlled.
I also had to change some things in factory.gd:
duplicating create_actor to have a create_player_actor, but if they remain the same and only change the base scene, then it might be better to add an optional parameter in create_actor.
adding some custom code to change the unit script to the "commander" script.
Here using set_script worked fine, so we can take a look again at the code you were having problems with, as the problem was most likely somewhere else and not in set_script. I do have to change the script here, before setting any of the unit's properties, otherwise they are all lost after I change the script.
I think this way we have some examples of using Inherited Scenes and not using them, though they're both really simple.
Let me know what you think of these changes, or if you want, we can go on a call and share screen to go over them in more detail, or even do some pair programming.
This partially solves #8. I hadn't seen that sprites were added to the issue, so I ended up using Godot's icon.
Run the scene
res://scenes/stages/commander_test/comander_test.tscn
with F6 to see it working.You can move your commander with wasd only for now, but you can't attack, so you'll take a beating from the AI Commander.
After you die, the game stops and prints "Game Over".
I created a player_actor scene that inherits from the actor scene, and uses a script that inherits from the Actor Script, so that I could override the "state machine" related functions and make it player controlled.
I also had to change some things in factory.gd:
create_actor
to have acreate_player_actor
, but if they remain the same and only change the base scene, then it might be better to add an optional parameter increate_actor
.set_script
worked fine, so we can take a look again at the code you were having problems with, as the problem was most likely somewhere else and not inset_script
. I do have to change the script here, before setting any of the unit's properties, otherwise they are all lost after I change the script.I think this way we have some examples of using Inherited Scenes and not using them, though they're both really simple.
Let me know what you think of these changes, or if you want, we can go on a call and share screen to go over them in more detail, or even do some pair programming.