Sprite Editor
Pyxen includes a full sprite editor for creating and editing pixel art directly inside your project in your browser, on Mac and Windows, and on iPad. No external tools needed.
On Windows, this page’s keys are pressed with Ctrl for Cmd, Alt for Option and Backspace for Delete: Fill with Colour is Ctrl+Backspace. Redo is Ctrl+Y.
Opening the sprite editor
Choose an image in Files: it opens straight in the sprite editor. To make a new one, choose File › New Asset… and pick Image.
On a narrow iPad window, the canvas takes the pane’s width and its panels are the tray’s tools at the window’s foot: Tools, Colour, Layers and Frames. A tilemap’s are Tools and Tiles.
Drawing tools
The tools run down the edge of the canvas, each with its key:
- Pencil (B) — draw pixels. Pixel-Perfect Pencil, in the ⋯ menu, keeps a line one pixel thin.
- Eraser (E) — remove pixels
- Fill (G) — flood-fill a connected area with the colour
- Line (L) — draw straight lines between two points
- Rectangle (U) and Circle (O) — draw shapes
- Eyedropper (I) — pick a colour from the canvas
Choose a colour and draw on the canvas. Zoom in with a pinch or by scrolling for pixel-precise work; Zoom to Fit (Cmd+0) shows the whole image. Symmetry, in the editor’s bar, mirrors what you draw horizontally, vertically, or both.
Colours
The side column holds the colour you draw with and the background colour (X swaps them), the colour as hex, the palette, and the colours you used last. Choose another palette in the ⋯ menu.
Selection tools
- Select (M) — drag to select a rectangular region
- Magic Wand (W) — select a connected region of the same colour
- Move (V) — drag the selection to place it; Return applies the move and Escape cancels it
With a selection, the canvas’s menu (right-click, or touch and hold) can:
- Cut (Cmd+X), Copy (Cmd+C) and Paste (Cmd+V)
- Delete — clear the selected region
- Deselect (Cmd+D) and Invert Selection (Shift+Cmd+I)
- Fill with Colour (Cmd+Delete) and Crop to Selection (Shift+Cmd+C)
On the iPad, the edit buttons over the canvas undo, redo, cut, copy and paste.
Layers
The layers sit under the palette. Add Layer adds one; each layer has a Visible and a Locked switch. A layer’s menu renames it, moves it up or down, sets its Opacity, Merge Down combines it with the one below, Flatten makes one layer of them all, and Delete Layer removes it.
Each layer is drawn independently. This lets you separate backgrounds, characters, and effects into different layers and edit them without affecting each other.
Placeholders
A project started in the Placeholders art style has a labelled block for each sprite, at the size the game uses. Files says Placeholder at the end of its row while the picture is still the block it was made as, and its menu starts with three ways to swap it:
- Draw (or Draw in the bar over the picture) adds an empty Drawing layer over the placeholder, which becomes a faint, locked Reference layer, “Not in the game”: the game and every export leave it out. Until you draw in a frame, the game keeps showing the placeholder there. Remove Reference takes the layer away.
- Replace With… brings in a picture of yours under the same name, so your code doesn’t change. When the sizes differ, choose Scale to Fit (the game keeps its layout) or Keep Size.
- Use From Another Style… makes just that sprite in another art style: Pixel, Generated, 1-bit, Flat or Placeholders.
Each is one change: Undo puts it back. To change the style of all the art at once, open Project Settings › Art › Change Style…: it makes again only the pictures still as the style made them, keeps the ones you changed, and lists both before you choose Change.
Resize, flip and rotate
Resize Image… changes the image’s size:
- Scale — scales the pixels with nearest-neighbour, with no blending
- Canvas — keeps the pixels where the anchor says and adds or removes space around them; new space is transparent
The canvas’s menu also has Trim to Content, Flip Horizontal, Flip Vertical, and rotations by 90° and 180°.
The grid (Grid in the bar) helps align tiles on a sheet; its size, its major lines and its colour are in the ⋯ menu.
Animation
The foot of the editor holds the image’s animations, for frame-by-frame sprite animations.
Creating animations
- Choose New Animation and give it a name (e.g., “walk”, “idle”, “attack”)
- Select tiles on your sprite sheet with the Tile Select tool (T), then choose Add to Animation
- Or choose Add Frame to add the next tile in reading order
Whole Sheet shows the whole image again; an animation’s menu renames or deletes it.
Editing frames
- Choose a frame to edit it on the canvas
- A frame’s menu moves it left or right, or removes it
- Play plays the animation, at the speed you set in frames per second (1 to 30)
Onion skin
Turn on Onion Skin to see a ghost of the previous frame while you edit. This helps keep frames consistent.
Isolate frame
Turn on Isolate Frame to hide the tiles around the frame you edit, so you can focus on it.
Using animations in code
Animations are saved in the sprite’s metadata. Play them in your game with the animation parameter:
player.sprite = Sprite("hero", animation="walk")
See Sprites and Rendering and the Sprite reference for the full API.
Used in Code in the pane’s bar says how many lines of your scripts name this image; choose one to go to it. In the code, Cmd+Click an image’s name to come back here, on the animation or the tile the call names.
Exporting a sprite
Export… at the end of the ⋯ menu, an animation’s Export Animation…, or File › Export Sprite… (Option+Cmd+E) opens Export Sprite. Choose what to make:
- Frame — one frame of an animation, as a PNG
- Sheet — the whole image, its layers merged, as a PNG
- Strip — an animation’s frames side by side, as a PNG
- Animated GIF — an animation, looping at its speed
Choose the Animation and, for Frame, the frame. Scale makes the file 1×, 2×, 4× or 8× as large, each pixel a sharp square. The preview is the file, with its name and size under it: [email protected], hero-walk-2.png for frame 2, hero-walk-strip.png, hero.png for the sheet.
Save… saves the file where you choose; on iPad, Share… opens the share sheet (Save to Files, Save Image, AirDrop); on the web, Download downloads it. Copy puts a PNG on the clipboard. On Mac and iPad, drag the preview to drop the file where you want it.
On Windows, Export Sprite is File › Export › Sprite… (Ctrl+Alt+E).
A GIF has no half-transparent pixels: a pixel at least half opaque is drawn solid, the rest is clear. A GIF frame lasts a whole number of hundredths of a second, so 8 fps plays at 0.13 s a frame, and nothing plays faster than 50 fps.
Undo and redo
Every change in the sprite editor can be undone (Cmd+Z) and redone (Cmd+Shift+Z) while the project is open.
Seeing your art in the game
Your game reads its images each time it starts: after you paint, run the game again to see the new pixels in the game preview. A running game keeps the images it started with.
Tips
- Work zoomed in for pixel-level detail, zoom out to see the full image
- A pack’s image opens read-only: choose Edit a Copy to make it your project’s own
- The sprite editor saves automatically — changes are written to the project file as you work
- On iPad with Apple Pencil, turn on Settings › Pixel Art › Draw with Apple Pencil only to draw with the pencil and pan with your finger