Hello everyone,
I started programing 2 weeks ago with godot and I have an issue understanding something.
I'm actually making a 2D platformer/puzzle game and for that I need a moving platform that can be activate and deactivate by using a switch.
I also want the platform to stop wherever it is when I turn off the switch and to move again on the same vector whenever I turn on the switch again)
I already made the switch by using an area 2D Node and this script:
var state: bool = false
func _physics_process(delta):
if (!state):
off_state()
else:
on_state()
func on_state():
if Input.is_action_just_pressed("action"):
animation_player.play("SwitchOff")
state = !state
func off_state():
if Input.is_action_just_pressed("action"):
animation_player.play("SwitchOn")
state = !state
I know I can emit a signal for both possibilities and use them to interract with my Platform script.
I tried with a tween node but nothing seems to work.
Can you explain to me how I can make it and show me an example.
I'm sorry if it can sounds confusing I'm totally new at this and don't understand some really easy stuff.