I have a character like superman, he can fly and walk on the platform. how to make a effective switch logic for this game??? like if “up” and “jump” button are pressed he start flying can move around in air by control keys and do things. And if
“jump” + “down” keys are pressed land on the ground and start walking again (effected by gravity) or by just pressing down key he moves down and when hit the platform become platformer character again?
Turn flying on:
Key j is pressed
Key Up is pressed
Automatism of character is active
||-----------------||
Deactivate automatism platformer of character: no
Turn flying off:
Key j is pressed
Key Down is pressed
Automatism of character is NOT active
||-----------------||
Deactivate automatism platformer of character: yes
You will also need to provide separate controls for flying:
Key Left is pressed
Automatism of character is NOT active
||-----------------||
Move character
etc…
Sorry, “Deactivate” is supposed to be “Activate”.
Just to warn that deactivating the Platform automatism for the character will allow it to go through platforms, so you’ll need another way to manage the player-platforms collision (the action to move away from objects, physics)
Instead deactivating the automatism, you could try to set the gravity or falling speed to 0, and use GD forces, but I’m not sure if it works at all
Mats, you could edit your previous post to avoid confusion