![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Et24 |
Sorry everyone I tried uploading pics but basically I just have a button called runbutton> toggle signal> connected to control> and I have that scene emitting signals to my player scene in the main and when I click the button in game the players move speed is updated to run speed. This works, however when I click the button after, my player doesn’t return to regular move speed, which is what I want. I’ve tried:
Emit_signal(“walk”) in control node script and all sorts of variations
Func _on_runbutton_run();
Speed = run speed
Ok this works, but i want my player to go back to just Speed when I click the button again.
Here is my code and signals I’ve connected
Control node>button
Script:
Extends control
Signal run
Signal walk
Func _on_button_toggled():
Emit signal(“run”) <-stops working here.
Pass
Emit signal(“walk”)<-this is just a guess I don’t know what I’m doing
Ok,
Main scene
2dnode
Player>kinematicbody2d>sprite>collision.
Runbutton->control>button
Player script:
Func _on_runbutton_run():
Speed=run speed
Func _on_runbutton_walk():
Speed = speed
And I have very basic movement functin, if key pressed move, physics process delta, vector2 etc.
Any thought into this matter is very much appreciated.