关于 fal-gamedev
用于通过 genmedia CLI 制作 2D 像素风游戏素材的技能,涵盖角色、动画精灵表、透明背景精灵和场景,并提供横版与等距 RPG 流程。
主要功能
- 01生成像素风角色
- 02制作横版游戏精灵表
- 03制作等距 RPG 精灵表
- 04移除精灵表背景
- 05生成视差与等距场景
适用场景
- 01根据文字或图片制作游戏角色
- 02生成行走、跳跃、攻击或待机动画
- 03制作透明背景精灵表
- 04创建横版或 RPG 游戏场景
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ fal-ai-community/ skills --skill fal-gamedev安装后在 Claude Code 中输入/fal-gamedev确认已加载。
详细介绍
2D 游戏素材
需要 genmedia CLI(运行一次
genmedia init)。
2D 像素风游戏素材的完整流水线:角色 → 精灵图集 → 移除背景 → 游戏背景。每个配方都可独立调用,只运行你需要的部分。
始终使用 --json,确保输出为机器可读格式。使用 --download 将文件保存到本地。不要手动 curl URL,使用 --download 标志。
执行规则,请严格遵守
-
每条 genmedia 命令 = 一次 Bash 工具调用:将每条
genmedia run和genmedia status作为单独的裸工具调用发出。不要使用变量赋值、管道或 Shell 重定向。这样可确保每次调用都符合genmedia *allowlist,无需权限提示即可运行。 -
并行任务 → 异步:将每条
genmedia run --async作为单独的 Bash 工具调用发出(不要合并到一个 Shell 代码块中)。所有任务都会排队,并在 fal 端并行运行;总耗时约等于最慢的单个任务。全部发出后,依次轮询每个任务的genmedia status(不要并行执行,以免一个失败导致其他任务取消)。
# Step 1, fire async (each line = its own Bash tool call, returns request_id immediately)
genmedia run fal-ai/nano-banana-pro/edit --prompt "$WALK_PROMPT" --image_urls "[\"$CHARACTER_URL\"]" --aspect_ratio "1:1" --resolution "1K" --async --json
genmedia run fal-ai/nano-banana-pro/edit --prompt "$IDLE_PROMPT" --image_urls "[\"$CHARACTER_URL\"]" --aspect_ratio "1:1" --resolution "1K" --async --json
# Step 2, poll sequentially (each line = its own Bash tool call)
genmedia status fal-ai/nano-banana-pro/edit <walk_request_id> --result --download ./walk.png --json
genmedia status fal-ai/nano-banana-pro/edit <idle_request_id> --result --download ./idle.png --json
-
URL 来源:始终从工具结果 JSON 中读取
downloaded_files[0].url。这是所有模型(nano、gpt、Bria)的正确路径。 -
Bria 同步调用:Bria(
fal-ai/bria/background/remove)没有队列端点,也不支持--async。请以同步方式运行。它会在数秒内完成。 -
文件夹结构:始终按以下布局保存,并根据角色描述生成角色 slug(kebab-case,例如
pirate-carrot):
./game-assets/
<character-slug>/
character.png
sprites/
walk.png
idle.png
attack.png
jump.png
backgrounds/
layer1-sky.png
layer2-midground.png
layer3-foreground.png
下载前先创建文件夹(mkdir -p)。即使只运行部分步骤,也使用此结构(例如,单个精灵图集也仍应放在 sprites/ 中)。
- 最终摘要:所有文件下载完成后,打印一份摘要,列出每个文件路径及其 CDN URL。格式如下:
=== Game Assets: pirate-carrot ===
character game-assets/pirate-carrot/character.png
https://...
walk game-assets/pirate-carrot/sprites/walk.png
https://...
- 状态轮询返回 400:
genmedia status --result只会获取一次结果,不会自动轮询。返回 400 且包含"Request is still in progress"时,表示任务仍在运行;等待 10 秒,然后使用相同的 request_id 重试完全相同的genmedia status调用。不要重新发出原来的genmedia run --async(任务已在 fal 端运行)。每隔 10–15 秒继续重试,直到成功获取结果。
适用场景
- 根据文本描述或参考图生成像素风角色
- 为横向卷轴游戏制作精灵图集动画(行走、跳跃、攻击、待机)
- 制作等距视角 RPG 精灵图集(不同方向的行走、攻击、待机)
- 移除精灵图集背景,生成透明 PNG
- 为横向卷轴游戏生成视差背景(3 层)
- 为 RPG 生成俯视等距视角游戏地图
模型栈
- Nano Banana Pro:
fal-ai/nano-banana-pro,用于角色和背景生成;质量更高、速度更快,推荐作为默认选项 - Nano Banana Pro Edit:
fal-ai/nano-banana-pro/edit,根据角色图像生成精灵图集 - GPT-Image-2:
openai/gpt-image-2,用于角色和背景生成;比 nano 慢,适用于用户偏好此模型或希望降低输出成本的情况(quality=low) - GPT-Image-2 Edit:
openai/gpt-image-2/edit,用于生成精灵图集;比 nano 慢,需要使用该模型专用的行走提示词;若要降低运行成本,请使用quality=low - Bria RMBG 2.0:
fal-ai/bria/background/remove,用于移除所有精灵图集的背景
配方 1:生成角色
询问用户角色描述(文本)或要转换的现有图像。询问模型偏好:nano(默认,质量更高、速度更快)或 gpt(速度较慢;如果用户希望降低成本,使用 quality=low)。
CHARACTER_STYLE_PROMPT="Generate a single character only, centered in the frame on a plain white background. The character should be rendered in detailed 32-bit pixel art style (like PlayStation 1 / SNES era games). Include proper shading, highlights, and anti-aliased edges for a polished look. The character should have well-defined features, expressive details, and rich colors. Show in a front-facing or 3/4 view pose, standing idle, suitable for sprite sheet animation."
IMAGE_TO_PIXEL_PROMPT="Transform this character into detailed 32-bit pixel art style (like PlayStation 1 / SNES era games). IMPORTANT: Must be a FULL BODY shot showing the entire character from head to feet. Keep the character centered in the frame on a plain white background. Include proper shading, highlights, and anti-aliased edges for a polished look. The character should have well-defined features, expressive details, and rich colors. Show in a front-facing or 3/4 view pose, standing idle, suitable for sprite sheet animation. Maintain the character's key features, colors, and identity while converting to pixel art."
# Text → pixel art character (nano)
genmedia run fal-ai/nano-banana-pro \
--prompt "$CHARACTER_STYLE_PROMPT Character: <character_desc>" \
--aspect_ratio "1:1" --resolution "1K" \
--download ./game-assets/<slug>/character.png --json
# Text → pixel art character (gpt)
genmedia run openai/gpt-image-2 \
--prompt "$CHARACTER_STYLE_PROMPT Character: <character_desc>" \
--image_size "square_hd" --quality "high" \
--download ./game-assets/<slug>/character.png --json
# Existing image → pixel art (nano), upload source image first, then run edit
genmedia upload /path/to/image.png --json
genmedia run fal-ai/nano-banana-pro/edit \
--prompt "$IMAGE_TO_PIXEL_PROMPT" \
--image_urls "[\"<uploaded_url_from_above>\"]" \
--aspect_ratio "1:1" --resolution "1K" \
--download ./game-assets/<slug>/character.png --json
从工具结果中读取 downloaded_files[0].url,即 CHARACTER_URL;所有精灵图集配方都需要此 URL。
配方 2:生成精灵图集
传入配方 1 中的 CHARACTER_URL。选择 --style side(横版卷轴)或 --style iso(等距视角 RPG)。选择模型:nano 或 gpt。
横版卷轴图集:4 帧 2×2 网格动画。支持的类型:walk、jump、attack、idle。除非用户明确要求,否则不要生成其他动画类型(受伤、死亡、奔跑等)。
异步启动所有图集生成任务(每个任务单独调用一次 Bash 工具),然后依次轮询:
WALK_PROMPT="Create a 4-frame pixel art walk cycle sprite sheet of this character. Arrange the 4 frames in a 2x2 grid on white background. The character is walking to the right. Top row (frames 1-2): Frame 1 (top-left): Right leg forward, left leg back - stride position. Frame 2 (top-right): Legs close together, passing/crossing - transition. Bottom row (frames 3-4): Frame 3 (bottom-left): Left leg forward, right leg back - opposite stride. Frame 4 (bottom-right): Legs close together, passing/crossing - transition back. Each frame shows a different phase of the walking motion. This creates a smooth looping walk cycle. Use detailed 32-bit pixel art style with proper shading and highlights. Same character design in all frames. Character facing right."
WALK_PROMPT_GPT="Create a 4-frame pixel art walk cycle sprite sheet of this character. Character orientation (critical): The character is shown in SIDE PROFILE, with their face, chest, and front foot pointing toward the RIGHT edge of the image. The character's back is on the LEFT side of the image. This is the same side-profile orientation used in classic 2D platformers like Super Mario Bros or Mega Man moving rightward across the screen. Arrange the 4 frames in a 2x2 grid on white background. Top row (frames 1-2): Frame 1 (top-left): Front leg (right leg) extended forward toward the right edge of the image, back leg extended behind toward the left edge. Frame 2 (top-right): Legs close together, passing pose. Bottom row (frames 3-4): Frame 3 (bottom-left): Opposite stride, back leg (left leg) now forward toward the right edge. Frame 4 (bottom-right): Legs close together, passing pose. Use detailed 32-bit pixel art style with proper shading and highlights. Same character design in all frames. All 4 frames must show the character from the SAME side profile angle, facing the RIGHT edge of the image."
JUMP_PROMPT="Create a 4-frame pixel art jump animation sprite sheet of this character. Arrange the 4 frames in a 2x2 grid on white background. The character is jumping. Top row (frames 1-2): Frame 1 (top-left): Crouch/anticipation - character slightly crouched, knees bent, preparing to jump. Frame 2 (top-right): Rising - character in air, legs tucked up, arms up, ascending. Bottom row (frames 3-4): Frame 3 (bottom-left): Apex/peak - character at highest point of jump, body stretched or tucked. Frame 4 (bottom-right): Landing - character landing, slight crouch to absorb impact. Use detailed 32-bit pixel art style with proper shading and highlights. Same character design in all frames. Character facing right."
ATTACK_PROMPT="Create a 4-frame pixel art attack animation sprite sheet of this character. Arrange the 4 frames in a 2x2 grid on white background. The character is performing an attack that fits their design - could be a sword slash, magic spell, punch, kick, or energy blast depending on what suits the character best. Top row (frames 1-2): Frame 1 (top-left): Wind-up/anticipation - character preparing to attack, pulling back weapon or gathering energy. Frame 2 (top-right): Attack in motion - the strike or spell being unleashed. Bottom row (frames 3-4): Frame 3 (bottom-left): Impact/peak - maximum extension of attack, weapon fully swung or spell at full power. Frame 4 (bottom-right): Recovery - returning to ready stance. Use detailed 32-bit pixel art style with proper shading and highlights. Same character design in all frames. Character facing right. Make the attack visually dynamic and exciting."
IDLE_PROMPT="Create a 4-frame pixel art idle/breathing animation sprite sheet of this character. Arrange the 4 frames in a 2x2 grid on white background. The character is standing still but with subtle idle animation. Top row (frames 1-2): Frame 1 (top-left): Neutral standing pose - relaxed stance. Frame 2 (top-right): Slight inhale - chest/body rises subtly, maybe slight arm movement. Bottom row (frames 3-4): Frame 3 (bottom-left): Full breath - slight upward posture. Frame 4 (bottom-right): Exhale - returning to neutral, slight settle. Keep movements SUBTLE - this is a gentle breathing/idle loop, not dramatic motion. Character should look alive but relaxed. Use detailed 32-bit pixel art style with proper shading and highlights. Same character design in all frames. Character facing right."
# Fire all 4 async, each is its own Bash tool call
genmedia run fal-ai/nano-banana-pro/edit --prompt "$WALK_PROMPT" --image_urls "[\"$CHARACTER_URL\"]" --aspect_ratio "1:1" --resolution "1K" --async --json
genmedia run fal-ai/nano-banana-pro/edit --prompt "$JUMP_PROMPT" --image_urls "[\"$CHARACTER_URL\"]" --aspect_ratio "1:1" --resolution "1K" --async --json
genmedia run fal-ai/nano-banana-pro/edit --prompt "$ATTACK_PROMPT" --image_urls "[\"$CHARACTER_URL\"]" --aspect_ratio "21:9" --resolution "1K" --async --json
genmedia run fal-ai/nano-banana-pro/edit --prompt "$IDLE_PROMPT" --image_urls "[\"$CHARACTER_URL\"]" --aspect_ratio "1:1" --resolution "1K" --async --json
# Poll each, each is its own Bash tool call, run sequentially
genmedia status fal-ai/nano-banana-pro/edit <walk_request_id> --result --download ./game-assets/<slug>/sprites/walk.png --json
genmedia status fal-ai/nano-banana-pro/edit <jump_request_id> --result --download ./game-assets/<slug>/sprites/jump.png --json
genmedia status fal-ai/nano-banana-pro/edit <attack_request_id> --result --download ./game-assets/<slug>/sprites/attack.png --json
genmedia status fal-ai/nano-banana-pro/edit <idle_request_id> --result --download ./game-assets/<slug>/sprites/idle.png --json
# GPT variants: replace fal-ai/nano-banana-pro/edit with openai/gpt-image-2/edit
# Walk must use WALK_PROMPT_GPT (not WALK_PROMPT)
# Replace --aspect_ratio with explicit --image_size:
# 1:1 → --image_size "square_hd"
# 21:9 → --image_size "{\"width\": 2688, \"height\": 1152}"
等距视角 RPG 图集:3/4 俯视视角。支持的类型:walk-down、walk-up、walk-side、attack-down、attack-up、attack-side、idle-iso。除非用户明确要求,否则不要生成其他动画类型。
先生成 attack-down,attack-up 和 attack-side 都会参考它以保持风格一致。
WALK_DOWN_PROMPT="Create a 4-frame pixel art walk cycle sprite sheet of this character walking DOWNWARD (toward the camera) in a top-down isometric RPG perspective (3/4 overhead view, like a classic top-down RPG). Arrange the 4 frames in a 2x2 grid on white background. The character is walking toward the viewer (south/down). Top row: Frame 1 (top-left): Left foot forward stride, arms swinging naturally. Frame 2 (top-right): Feet together, passing/transition pose. Bottom row: Frame 3 (bottom-left): Right foot forward stride, arms swinging naturally. Frame 4 (bottom-right): Feet together, passing/transition back. We see the character's front/face. Top-down 3/4 view - we see the top of their head slightly. Use detailed 32-bit pixel art style with proper shading and highlights. Same character design in all frames."
WALK_UP_PROMPT="Create a 4-frame pixel art walk cycle sprite sheet of this character walking UPWARD (away from the camera) in a top-down isometric RPG perspective (3/4 overhead view, like a classic top-down RPG). Arrange the 4 frames in a 2x2 grid on white background. CRITICAL: ALL 4 frames must show the character from EXACTLY the same angle, their BACK, facing directly away from the camera. Do NOT rotate or twist the character between frames. The ONLY difference between frames should be the leg and arm positions. Top row: Frame 1 (top-left): Left foot forward. BACK VIEW. Frame 2 (top-right): Feet together. BACK VIEW. Bottom row: Frame 3 (bottom-left): Right foot forward. BACK VIEW. Frame 4 (bottom-right): Feet together. BACK VIEW. Use detailed 32-bit pixel art style. Same character design in all frames."
WALK_SIDE_PROMPT="Create a 4-frame pixel art walk cycle sprite sheet of this character WALKING TO THE RIGHT in a top-down isometric RPG perspective (3/4 overhead view, like a classic top-down RPG). Arrange the 4 frames in a 2x2 grid on white background. The character is FACING RIGHT and WALKING RIGHT. Top row: Frame 1 (top-left): Right leg forward, left leg back - stride, arms swinging. Frame 2 (top-right): Legs close together, passing - transition. Bottom row: Frame 3 (bottom-left): Left leg forward, right leg back - opposite stride, arms swinging. Frame 4 (bottom-right): Legs close together, passing - transition back. We see the character's RIGHT-facing side profile from a top-down 3/4 overhead angle. Use detailed 32-bit pixel art style. Same character design in all frames."
ATTACK_DOWN_PROMPT="Create a 4-frame pixel art ATTACK animation sprite sheet of this character attacking DOWNWARD (toward the camera) in a top-down isometric RPG perspective (3/4 overhead view). Arrange the 4 frames in a 2x2 grid on white background. Top row: Frame 1 (top-left): Wind-up/anticipation - preparing to strike. Frame 2 (top-right): Attack in motion - strike unleashed toward camera. Bottom row: Frame 3 (bottom-left): Impact/peak - maximum extension. Frame 4 (bottom-right): Recovery. We see the character's front/face. The attack should fit the character's design. Use detailed 32-bit pixel art style. Make the attack visually dynamic."
ATTACK_UP_PROMPT="Create a 4-frame pixel art ATTACK animation sprite sheet of this character attacking UPWARD (away from the camera) in a top-down isometric RPG perspective. I've also sent you a reference of the same character's front-facing attack. Use the EXACT SAME attack type, weapon, and visual effects - just show it from behind. Arrange the 4 frames in a 2x2 grid on white background. Top row: Frame 1 (top-left): Wind-up from behind. Frame 2 (top-right): Attack unleashed upward/away. Bottom row: Frame 3 (bottom-left): Impact/peak. Frame 4 (bottom-right): Recovery. We see the character's back. MUST use the same attack style as the reference image. Use detailed 32-bit pixel art style."
ATTACK_SIDE_PROMPT="Create a 4-frame pixel art ATTACK animation sprite sheet of this character attacking SIDEWAYS (to the right) in a top-down isometric RPG perspective. I've also sent you a reference of the same character's front-facing attack. Use the EXACT SAME attack type, weapon, and visual effects - just show it from the side profile. Arrange the 4 frames in a 2x2 grid on white background. Character faces RIGHT. Top row: Frame 1 (top-left): Wind-up from side, facing right. Frame 2 (top-right): Strike unleashed to the right. Bottom row: Frame 3 (bottom-left): Impact/peak. Frame 4 (bottom-right): Recovery. IMPORTANT: Show the character's SIDE PROFILE facing RIGHT. MUST use the same attack style as the reference image. Use detailed 32-bit pixel art style."
IDLE_ISO_PROMPT="Create a 4-frame pixel art idle/breathing animation sprite sheet of this character in a top-down isometric RPG perspective (3/4 overhead view). Arrange the 4 frames in a 2x2 grid on white background. Character is FACING TOWARD THE CAMERA (south/down). Top row: Frame 1 (top-left): Neutral standing pose, facing down. Frame 2 (top-right): Slight inhale - body rises subtly. Bottom row: Frame 3 (bottom-left): Full breath - slight upward posture. Frame 4 (bottom-right): Exhale - returning to neutral. Keep movements SUBTLE. Use detailed 32-bit pixel art style. Same character design in all frames."
# Fire walk sheets + idle async, each is its own Bash tool call
genmedia run fal-ai/nano-banana-pro/edit --prompt "$WALK_DOWN_PROMPT" --image_urls "[\"$CHARACTER_URL\"]" --aspect_ratio "1:1" --resolution "1K" --async --json
genmedia run fal-ai/nano-banana-pro/edit --prompt "$WALK_UP_PROMPT" --image_urls "[\"$CHARACTER_URL\"]" --aspect_ratio "1:1" --resolution "1K" --async --json
genmedia run fal-ai/nano-banana-pro/edit --prompt "$WALK_SIDE_PROMPT" --image_urls "[\"$CHARACTER_URL\"]" --aspect_ratio "1:1" --resolution "1K" --async --json
genmedia run fal-ai/nano-banana-pro/edit --prompt "$IDLE_ISO_PROMPT" --image_urls "[\"$CHARACTER_URL\"]" --aspect_ratio "1:1" --resolution "1K" --async --json
# Poll walk results sequentially
genmedia status fal-ai/nano-banana-pro/edit <walk_down_request_id> --result --download ./game-assets/<slug>/sprites/walk-down.png --json
genmedia status fal-ai/nano-banana-pro/edit <walk_up_request_id> --result --download ./game-assets/<slug>/sprites/walk-up.png --json
genmedia status fal-ai/nano-banana-pro/edit <walk_side_request_id> --result --download ./game-assets/<slug>/sprites/walk-side.png --json
genmedia status fal-ai/nano-banana-pro/edit <idle_iso_request_id> --result --download ./game-assets/<slug>/sprites/idle-iso.png --json
# Attack-down sync, needed as reference before firing attack-up and attack-side
genmedia run fal-ai/nano-banana-pro/edit --prompt "$ATTACK_DOWN_PROMPT" --image_urls "[\"$CHARACTER_URL\"]" --aspect_ratio "9:16" --resolution "1K" --download ./game-assets/<slug>/sprites/attack-down.png --json
# Fire attack-up and attack-side async, passing attack-down URL from above result
genmedia run fal-ai/nano-banana-pro/edit --prompt "$ATTACK_UP_PROMPT" --image_urls "[\"$CHARACTER_URL\", \"<attack_down_url>\"]" --aspect_ratio "9:16" --resolution "1K" --async --json
genmedia run fal-ai/nano-banana-pro/edit --prompt "$ATTACK_SIDE_PROMPT" --image_urls "[\"$CHARACTER_URL\", \"<attack_down_url>\"]" --aspect_ratio "16:9" --resolution "1K" --async --json
genmedia status fal-ai/nano-banana-pro/edit <attack_up_request_id> --result --download ./game-assets/<slug>/sprites/attack-up.png --json
genmedia status fal-ai/nano-banana-pro/edit <attack_side_request_id> --result --download ./game-assets/<slug>/sprites/attack-side.png --json
# GPT variants: replace fal-ai/nano-banana-pro/edit with openai/gpt-image-2/edit
# Replace --aspect_ratio with explicit --image_size:
# 1:1 → --image_size "square_hd"
# 9:16 → --image_size "{\"width\": 720, \"height\": 1280}"
# 16:9 → --image_size "{\"width\": 1280, \"height\": 720}"
配方 3:移除背景
Bria 没有队列端点,请同步运行(不要使用 --async)。每项任务单独调用一次 Bash 工具:
genmedia run fal-ai/bria/background/remove --image_url "<walk_url>" --download ./game-assets/<slug>/sprites/walk-transparent.png --json
genmedia run fal-ai/bria/background/remove --image_url "<jump_url>" --download ./game-assets/<slug>/sprites/jump-transparent.png --json
genmedia run fal-ai/bria/background/remove --image_url "<attack_url>" --download ./game-assets/<slug>/sprites/attack-transparent.png --json
genmedia run fal-ai/bria/background/remove --image_url "<idle_url>" --download ./game-assets/<slug>/sprites/idle-transparent.png --json
配方 4:生成背景
**流水线说明:**第 1 层(天空)和等距地图只需要 CHARACTER_DESC,不需要图像参考。生成角色后立即异步启动第 1 层,使其在生成精灵图集时并行运行。第 2 层和第 3 层需依次生成(每层都需要前一层工具结果中的 URL)。
横版卷轴,3 层视差背景
# Layer 1, sky/backdrop. Fire async (no image dep) so it runs in parallel with sprite generation
genmedia run fal-ai/nano-banana-pro \
--prompt "Create the SKY/BACKDROP layer for a side-scrolling pixel art game parallax background. This is for a character: <character_desc>. Create an environment that fits this character's world. This is the FURTHEST layer - only sky and very distant elements (distant mountains, clouds, horizon). Style: Pixel art, 32-bit retro game aesthetic. Wide panoramic scene." \
--aspect_ratio "21:9" --resolution "1K" --async --json
# Poll Layer 1 (after sprite sheets are done), then read its URL from the result
genmedia status fal-ai/nano-banana-pro <layer1_request_id> --result --download ./game-assets/<slug>/backgrounds/layer1-sky.png --json
# Layer 2, midground (needs CHARACTER_URL + layer1 URL from above result)
genmedia run fal-ai/nano-banana-pro/edit \
--prompt "Create the MIDDLE layer of a 3-layer parallax background for a side-scrolling pixel art game. I've sent you images of: 1) the character, 2) the sky layer already created. Create the character's ICONIC/CANONICAL location from their story, home village, famous landmarks, signature battlegrounds. Elements should fill the frame from middle down to bottom. Style: Pixel art matching the other images. IMPORTANT: Use a transparent background so this layer can overlay the others." \
--image_urls "[\"<character_url>\", \"<layer1_url>\"]" \
--aspect_ratio "21:9" --resolution "1K" --download ./game-assets/<slug>/backgrounds/layer2-midground.png --json
# Bria bg-remove on layer 2 (sync, no queue endpoint)
genmedia run fal-ai/bria/background/remove --image_url "<layer2_url>" --download ./game-assets/<slug>/backgrounds/layer2-transparent.png --json
# Layer 3, foreground (needs CHARACTER_URL + layer1 URL + layer2-transparent URL from above result)
genmedia run fal-ai/nano-banana-pro/edit \
--prompt "Create the FOREGROUND layer of a 3-layer parallax background for a side-scrolling pixel art game. I've sent you images of: 1) the character, 2) the sky layer, 3) the middle layer. Create the closest foreground elements (ground, grass, rocks, platforms) that complete the scene. Style: Pixel art matching the other images. IMPORTANT: Use a transparent background so this layer can overlay the others." \
--image_urls "[\"<character_url>\", \"<layer1_url>\", \"<layer2_transparent_url>\"]" \
--aspect_ratio "21:9" --resolution "1K" --download ./game-assets/<slug>/backgrounds/layer3-foreground.png --json
# Bria bg-remove on layer 3 (sync, no queue endpoint)
genmedia run fal-ai/bria/background/remove --image_url "<layer3_url>" --download ./game-assets/<slug>/backgrounds/layer3-transparent.png --json
# GPT variant: replace nano endpoints with openai/gpt-image-2 and openai/gpt-image-2/edit
# Use --image_size '{"width": 2688, "height": 1152}' for 21:9 with gpt
等距视角,单张俯视地图
genmedia run fal-ai/nano-banana-pro \
--prompt "Create a large, detailed top-down isometric pixel art game world map for a character: $CHARACTER_DESC. Do not place the character on the map. Style: Classic RPG top-down map, 3/4 overhead perspective. Include: winding dirt/stone paths connecting areas, a small body of water, a few buildings or structures that fit the character's world, rocky areas or hills, various terrain types. Single large continuous map image (NOT tiled, NOT a tileset). Complete explorable game world viewed from above. Detailed 32-bit pixel art style. Fill the entire image with map content, no empty borders." \
--aspect_ratio "1:1" --resolution "1K" \
--download ./game-assets/<slug>/backgrounds/map.png --json
参数
- 模型:
nano是默认模型,质量更好、速度更快。gpt速度较慢;仅在用户明确要求使用它或要求最便宜的选项时使用。在这种情况下,设置--quality "low"以大幅降低成本 - 行走动画 + gpt-image-2:始终使用
WALK_PROMPT_GPT,而不是WALK_PROMPT。GPT 需要明确的侧面朝向说明,才能正确生成方向 - 攻击动画宽高比:横版卷轴攻击动画使用
21:9(nano)或2688×1152(gpt)。等距视角攻击动画:向下/向上使用9:16,侧向使用16:9 - 等距视角的 attack-up 和 attack-side:始终将
ATTACK_DOWN_URL作为第二张参考图传入,以保持不同方向的攻击风格一致 - 背景层:按顺序生成(1 → 2 → 3)。每层都参考前一层。第 1 层保留背景;第 2 层和第 3 层移除背景