Gommand is a command-based framework for Godot 4.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
Gommand is a command framework for Godot 4 that helps you write declarative code. It is inspired by the command framework as part of WPILib.
What you get:
- Declarative style: describe your code in a way that is more "what" than "how"
- Composable flows: chain sequences, run things in parallel, add conditions and repeats
- Input wiring: bind player actions to commands with
ActionTrigger
extends Node3D
var is_dashing := false
var dash_time := 0.0
var attack_pending := false
func _ready() -> void:
print("Press ui_accept to dash, then attack.")
func _physics_process(delta: float) -> void:
if Input.is_action_just_pressed("ui_accept") and not is_dashing:
is_dashing = true
dash_time = 0.2
start_dash()
if is_dashing:
dash_time -= delta
if dash_time <= 0.0:
is_dashing = false
stop_dash()
attack_pending = true
if attack_pending:
attack_pending = false
attack_target()
func start_dash() -> void:
print("Dash start")
func stop_dash() -> void:
print("Dash end")
func attack_target() -> void:
print("Attack")extends Node3D
var trigger: ActionTrigger
func _ready() -> void:
print("Press ui_accept to run dash + attack sequence.")
var dash_and_attack := SequentialCommandGroup.new([
PrintCommand.new("Dash start"),
WaitCommand.new(0.2),
PrintCommand.new("Dash end"),
PrintCommand.new("Attack"),
])
trigger = (
ActionTrigger
.builder("ui_accept")
.add_on_action_pressed(dash_and_attack)
.build()
)- Core framework
- Documentation
See the open issues for a full list of proposed features and known issues.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.