Loading...
Loading...
Generate and add sprites to a Remix game
npx skill4agent add farworld-labs/remix-skills remix-add-spriteREMIX_API_KEY.remix-settings.jsongameId.remix-settings.jsongameIdPOST https://api.remix.gg/v1/games/{gameId}/sprites/generate
Authorization: Bearer $REMIX_API_KEY
Content-Type: application/json
{
"prompt": "a pixel-art knight walking animation, 4 frames",
"gridSize": 4,
"imageUrl": null
}promptgridSizeimageUrlspriteUrltransparentSpriteUrldrawImageconst sprite = new Image();
sprite.src = "https://returned-sprite-url.png";
const frameWidth = 64; // width of a single frame
const frameHeight = 64; // height of a single frame
const totalFrames = 4;
let currentFrame = 0;
sprite.onload = () => {
function animate() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
// Draw the current frame from the sprite sheet
ctx.drawImage(
sprite,
currentFrame * frameWidth, 0, // source x, y in the sprite sheet
frameWidth, frameHeight, // source width, height
player.x, player.y, // destination x, y on canvas
frameWidth, frameHeight // destination width, height
);
currentFrame = (currentFrame + 1) % totalFrames;
requestAnimationFrame(animate);
}
animate();
};transparentSpriteUrlgridSizetransparentSpriteUrlonload