Generate and export pixel art VFX for Godot 4

Create a pixel effect, export a Godot 4 pack and instance its AnimatedSprite2D scene, with beat signals for damage and screen shake.

1. Generate or choose an effect

Describe the effect in the workspace. Give the camera view, pixel size, facing, palette, duration and impact time. This link prefills a draft; it does not generate. Sign in and send when ready. Refine the result in chat or edit its parts. You can also start with the MIT library sword slash.

2. Export the Godot pack

In the workspace choose Godot 4 pack (scene + frames). Colors, mirroring, speed, timing and part edits are reflected in exports; the preview background is not. Inspect the exported timing before wiring gameplay to it. An unchanged library pack is available as sword-slash Godot pack.

Unzip the folder into res://vfx/. The example below uses the library pack’s sword_slash folder; substitute your generated pack’s filename. Names are lowercased with punctuation converted to underscores. Resource references are relative to the pack folder.

  • name.png: transparent sprite sheet
  • name.tres: SpriteFrames with frame durations and loop flag
  • name.tscn: AnimatedSprite2D scene with nearest filtering and pivot offset
  • vfxsmith_effect.gd: playback, facing and impact signal script
  • name.json: frame size, FPS, pivot, beatFrames and beatSeconds
  • README.txt and the included license notices: import help and source attribution

3. Instance the scene and connect damage and screen shake

Attach this example to a Node2D in your world, assign its Camera2D in the inspector, and call play_slash(hit_point, facing_dir, target) from your attack logic. The target’s take_damage method belongs to your game; it is not supplied by the exported effect. The visual does not perform collision detection.

extends Node2D

const SLASH = preload("res://vfx/sword_slash/sword_slash.tscn")
@export var camera: Camera2D
var shake: Tween
var camera_rest := Vector2.ZERO

func _ready() -> void:
    if is_instance_valid(camera):
        camera_rest = camera.offset

func play_slash(hit_point: Vector2, facing_dir: float, target: Node) -> void:
    var fx = SLASH.instantiate()
    # Connect before adding the scene, including effects with a frame-zero beat.
    fx.beat.connect(_on_impact.bind(target))
    fx.facing = facing_dir  # -1 mirrors an effect authored facing right
    add_child(fx)
    fx.global_position = hit_point  # node position is the exported pivot

func _on_impact(index: int, target: Node) -> void:
    if index != 0:  # damage once; remove this guard for intentional multi-hit attacks
        return
    if is_instance_valid(target) and target.has_method("take_damage"):
        target.call("take_damage", 10)  # your game's damage method
    if is_instance_valid(camera):
        if shake and shake.is_valid():
            shake.kill()
        camera.offset = camera_rest
        shake = create_tween()
        shake.tween_property(camera, "offset", camera_rest + Vector2(4, 0), 0.03)
        shake.tween_property(camera, "offset", camera_rest + Vector2(-3, 1), 0.03)
        shake.tween_property(camera, "offset", camera_rest, 0.06)

Understand beat timing

The exported script declares signal beat(index: int). The scene’s beats array holds frame indices, while the emitted index is the zero-based ordinal of the beat, not a frame number. Frame-zero beats are deferred by the script. Check beatFrames in the pack JSON: if it is empty, the effect emits no damage signal. Set or refine the impact timing and re-export rather than assuming every effect has a hit.

For a multi-hit attack, remove the single-hit guard only if you intend damage on each exported beat. The script consumes its beats once per instance, including for looping effects.

Lifetime, facing and scale

One-shots free themselves on animation completion when free_on_finish is true. Loops keep playing until you stop or free them. Spawn a new instance for each attack: calling play() on a finished instance does not reset the script’s beat cursor. Set facing = -1 to mirror a right-facing effect; use whole-number scales to keep pixels crisp.

Licenses and next steps

Keep Patch’s MIT copyright and permission notices with library assets and incorporated upstream material. Original generated assets follow the generated-output terms. See Source and licenses.

A downloadable, runnable tutorial sample project is a later task and is not available yet. The library pack linked above is an effect asset, not a complete game project. Claude Code and Codex setup explains how an agent can install these exports with VfxSmith MCP and the official skill.

Find an effect to try