dragonruby
/dragonruby
Wspiera tworzenie gier 2D w DragonRuby: pętla gry, metoda tick, renderowanie sprite'ów, stan gry, kolizje, animacje i zarządzanie scenami.
- Autor
- hoblin ↗
- Repozytorium
- claude-ruby-marketplace ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 07.09.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 59
- Skrypty
- 43
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 07.09.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
- 43 skrypty w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.
Skrypty: examples/audio/audio_events.rb, examples/audio/background_music.rb, examples/audio/crossfade.rb, examples/audio/music_controls.rb, examples/audio/sound_effects.rb, examples/core/coordinate_system.rb, examples/core/hello_world.rb, examples/core/labels.rb
Co robi i kiedy
Wspiera tworzenie gier 2D w DragonRuby: pętla gry, metoda tick, renderowanie sprite'ów, stan gry, kolizje, animacje i zarządzanie scenami.
Wyzwalacze z opisu
Oryginalny opis (EN)
This skill should be used when the user asks to "create a game", "make a game", "game development", "dragonruby", "drgtk", "game loop", "tick method", "sprite rendering", "game state", or mentions args.outputs, args.state, args.inputs, coordinate system, collision detection, animation frames, or scene management. Should also be used when editing DragonRuby game files, working on 2D game logic, or discussing game performance optimization.
Jak działa
- Quick Reference
- Rendering Primitives
- State Management
- Input Handling
- Collision Detection
- Animation
- Scene Management
- Best Practices
- Additional Resources
- Development Workflow
Podgląd SKILL.md
---
name: dragonruby
description: >-
This skill should be used when the user asks to "create a game", "make a
game", "game development", "dragonruby", "drgtk", "game loop", "tick method",
"sprite rendering", "game state", or mentions args.outputs, args.state,
args.inputs, coordinate system, collision detection, animation frames, or
scene management. Should also be used when editing DragonRuby game files,
working on 2D game logic, or discussing game performance optimization.
version: 1.0.5
---
# DragonRuby Game Toolkit
This skill provides comprehensive guidance for building 2D games with DragonRuby Game Toolkit (DRGTK). Use for game loop implementation, sprite rendering, input handling, collision detection, animation, and scene management.
## Quick Reference
### Basic Game Structure
```ruby
def boot args
args.state = {}
end
def tick args
# Called 60 times per second
args.state.player ||= { x: 640, y: 360, w: 50, h: 50, path: 'player.png' }
# Handle input
args.state.player.x += 5 if args.inputs.right
args.state.player.x -= 5 if args.inputs.left
# Render
args.outputs.sprites << args.state.player
end
```
### Key Concepts
| Concept | Purpose |
|---------|---------|
| `def tick(args)` | Main game loop (60 FPS) |
| `args.outputs` | Render sprites, labels, primitives |
| `args.state` | Persistent game data storage |
| `args.inputs` | Keyboard, mouse, controller input |
| `args.grid` | Screen dimensions (1280x720) |
| `Geometry` | Collision detection helpers |
### Coordinate System
- **Screen**: 1280x720 pixels
- **Origin**: Bottom-left (0, 0)
- **Y-axis**: Increases upward
```
(0, 720) ─────────────── (1280, 720)
│ │
│ 1280 × 720 │
│ │
(0, 0) ─────────────── (1280, 0)
```
## Rendering Primitives
Use `args.outputs.primitives` for FIFO (first-in, first-out) render order control.
### Sprites (Images)
```ruby
args.outputs.primitives << {
x: 100, y: 100, w: 64, h: 64,
path: 'sprites/player.png',
angle: 45,
anchor_x: 0.5, anchor_y: 0.5,
r: 255, g: 255, b: 255, a: 255,
flip_horizontally: false
}
```
### Labels (Text)
```ruby
args.outputs.primitives << {
x: 640, y: 360,
text: "Score: #{args.state.score}",
size_px: 22,
anchor_x: 0.5, anchor_y: 0.5,
r: 255, g: 255, b: 255
}
```
### Solids and Borders
```ruby
# Filled rectangle (use primitive_marker: :solid)
args.outputs.primitives << {
x: 0, y: 0, w: 100, h: 100,
r: 255, g: 0, b: 0,
primitive_marker: :solid
}
# For many rectangles, use path: :solid for better performance
args.outputs.primitives << { x: 0, y: 0, w: 100, h: 100, path: :solid, r: 255, g: 0, b: 0 }
# Outline rectangle
args.outputs.primitives << { x: 0, y: 0, w: 100, h: 100, r: 0, g: 0, b: 0, primitive_marker: :border }
```
## State Management
Use `args.state` with `||=` for lazy initialization:
```ruby
def tick args
args.state.player ||= { x: 640, y: 360 }
args.state.enemies ||= []
args.state.score ||= 0
args.state.scene ||= :title
end
```
## Input Handling
### Unified Input (Keyboard + Controller)
```ruby
# Directional (arrows, WASD, gamepad)
args.inputs.up / down / left / right
# Magnitude values
args.inputs.left_right # -1, 0, or 1
args.inputs.up_down # -1, 0, or 1
```
### Keyboard
```ruby
args.inputs.keyboard.key_down.space # Pressed this frame
args.inputs.keyboard.key_held.space # Held down
args.inputs.keyboard.key_up.space # Released this frame
```
### Mouse
```ruby
args.inputs.mouse.click # Any button clicked
args.inputs.mouse.x / .y # Position
args.inputs.mouse.inside_rect?(rect) # Collision check
```
## Collision Detection
```ruby
if Geometry.intersect_rect?(player, enemy)
enemy.dead = true
args.state.score += 1
end
# Clean up dead entities
args.state.enemies.reject! { |e| e.dead }
```
## Animation
```ruby
# Frame-based animation
sprite_index = 0.frame_index(count: 6, hold_for: 8, repeat: true)
args.state.player.path = "sprites/player-#{sprite_index}.png"
```
## Scene Management
```ruby
def tick args
args.state.scene ||= :title
send("#{args.state.scene}_tick", args)
end
def title_tick args
args.outputs.labels << { x: 640, y: 400, text: "Press SPACE", anchor_x: 0.5 }
args.state.scene = :gameplay if args.inputs.keyboard.key_down.space
end
def gameplay_tick args
# Game logic here
end
```
## Best Practices
### Do
- Use hash syntax for sprites/labels (clearer than arrays)
- Use `||=` for state initialization
- Remove offscreen entities to prevent memory leaks
- Update logic before rendering
- Use `$gtk.reset` during development to reset state
- Use `args.outputs.primitives` for FIFO render order control
- Use `primitive_marker: :solid` or `:border` for rectangle types
### Don't
- Hardcode magic numbers (use constants like `FPS = 60`)
- Forget early returns in scene methods
- Render before updating state (causes 1-frame lag)
- Let collections grow infinitely (reject dead entities)
## Additional Resources
### Reference Files
For detailed API documentation and patterns:
- **`references/core.md`** - Game loop, args object, rendering, coordinates
- **`references/input.md`** - Keyboard, mouse, controller input patterns
- **`references/entities.md`** - Entity spawning, collision, lifecycle
- **`references/game-logic/state.md`** - Timers, scoring, scene transitions
- **`references/game-logic/persistence.md`** - Save/load, file I/O patterns
- **`references/audio.md`** - Sound effects, music playback, audio controls
- **`references/rendering/primitives.md`** - Sprites, labels, solids, borders, layering
- **`references/rendering/animation.md`** - frame_index, spritesheets, easing functions
### Example Files
Working code in `examples/`:
- **`examples/core/`** - Hello world, sprites, labels, state, coordinates
- **`examples/input/`** - Directional, keyboard, mouse, movement
- **`examples/entities/`** - Storage, factories, collision, lifecycle
- **`examples/game-logic/`** - Timers, scoring, save/load, state transitions
- **`examples/audio/`** - Sound effects, background music, pause/resume
- **`examples/rendering/`** - Sprites, labels, animation, layering
## Development Workflow
```ruby
def tick args
# Game logic
end
$gtk.reset # Add at end during development
```
### Reset Methods
```ruby
$gtk.reset # Immediate reset
$gtk.reset_next_tick # Reset before next tick (safer)
```
### Debug Output
```ruby
args.outputs.debug << "Frame: #{Kernel.tick_count}"
args.outputs.debug.watch args.state.player
```
Pliki w paczce (59)
- SKILL.md 6 KB
- examples/audio/audio_events.rb 1 KB
- examples/audio/background_music.rb 1 KB
- examples/audio/crossfade.rb 1 KB
- examples/audio/music_controls.rb 1 KB
- examples/audio/sound_effects.rb 1 KB
- examples/core/coordinate_system.rb 1 KB
- examples/core/hello_world.rb 1 KB
- examples/core/labels.rb 1 KB
- examples/core/sprites.rb 1 KB
- examples/core/state_management.rb 1 KB
- examples/distribution/background_pause.rb 1 KB
- examples/distribution/build_workflow.sh 1 KB
- examples/distribution/cvars_production.txt 1 KB
- examples/distribution/game_metadata_hd.txt 1 KB
- examples/distribution/game_metadata_minimal.txt 1 KB
- examples/distribution/game_metadata_mobile.txt 1 KB
- examples/distribution/platform_detection.rb 1 KB
- examples/distribution/steam_metadata.txt 1 KB
- examples/entities/collision_detection.rb 1 KB
- examples/entities/entity_lifecycle.rb 2 KB
- examples/entities/entity_storage.rb 1 KB
- examples/entities/factory_methods.rb 1 KB
- examples/entities/random_spawning.rb 1 KB
- examples/game-logic/reset_patterns.rb 3 KB
- examples/game-logic/save_load.rb 3 KB
- examples/game-logic/scoring.rb 2 KB
- examples/game-logic/state_transitions.rb 2 KB
- examples/game-logic/timers.rb 2 KB
- examples/input/action_triggers.rb 1 KB
- examples/input/analog_movement.rb 1 KB
- examples/input/controller_input.rb 1 KB
- examples/input/directional_input.rb 1 KB
- examples/input/keyboard_input.rb 1 KB
- examples/input/mouse_click.rb 1 KB
- examples/input/movement_with_bounds.rb 1 KB
- examples/input/normalized_movement.rb 1 KB
- examples/rendering/frame_animation.rb 1 KB
- examples/rendering/labels.rb 1 KB
- examples/rendering/layering.rb 2 KB
- examples/rendering/solids.rb 2 KB
- examples/rendering/sprites.rb 1 KB
- examples/rendering/spritesheet_animation.rb 1 KB
- examples/scenes/case_dispatch.rb 1 KB
- examples/scenes/class_based.rb 2 KB
- examples/scenes/pause_overlay.rb 2 KB
- examples/scenes/safe_transitions.rb 1 KB
- examples/scenes/scene_transitions.rb 2 KB
- examples/scenes/send_dispatch.rb 2 KB
- references/audio.md 9 KB
- references/core.md 8 KB
- references/distribution.md 10 KB
- references/entities.md 11 KB
- references/input.md 10 KB
- references/scenes.md 10 KB
- references/game-logic/persistence.md 8 KB
- references/game-logic/state.md 7 KB
- references/rendering/animation.md 11 KB
- references/rendering/primitives.md 10 KB
Wersje
W bazie nie ma innych skilli o nazwie dragonruby.
Migawka bazy z 28.10.2026 · wersja paczki 8fdd76f96916 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100game-engine
Wspiera budowę silników i gier webowych w HTML5, Canvas, WebGL i JavaScript: pętle gry, fizyka, kolizje, sprite'y, sterowanie, dźwięk, multiplayer przez WebRTC i publikacja. - 100playdate-dev
Wspiera tworzenie gier na Playdate w Lua z Playdate SDK: pętla gry, sprite'y, grafika, wejście (crank, przyciski, akcelerometr), dźwięk, UI, wydajność, pdxinfo i praca z symulatorem. - 95infrastructure-claude-code-game-workflow
Wskazuje, który skill przeczytać przy projekcie gry, i prowadzi przez ekosystem skilli do tworzenia gier. - 95game-development
Wspiera tworzenie gier w Unity, Unreal Engine i Godot: mechaniki, fizykę i AI w silnikach gier. - 95engineering-game-backend-architecture
Projektuje serwery gier: połączenia WebSocket, pokoje, pętlę tików i architekturę autorytatywną po stronie serwera. - 100asset-pipeline
Przygotowuje grafikę do wczytania przez silnik gry: wycinanie sprite'ów, pikselizacja do palety, arkusze sprite'ów, maski kolorów drużyn, płynne tekstury i render modelu 3D w Blenderze do klatek.