For my midterm project I will be creating an interactive artwork entitled Wanderer which will take the form of a visual loop featuring a figure that walks through various landscapes. The interaction itself will be fairly simple as the user will only be able to initiate the figure’s movement and change the landscape in which the figure is walking. I have chosen to simplify the interaction as a means to draw attention towards the work’s visual qualities which will (hopefully) be satisfying to look at. To fulfil the brief, I plan to incorporate an “energy” meter which will cause the session to restart if it reaches zero. As of right now, I have started working on a sprite sheet and will make progress on the backgrounds in the coming days.
let spritesheet; let sprites = []; let direction = 1; let step = 0; let x; let y; let speed = 7; let stepSpeed = 60; let animationTimer; let automaticMovement = false; function preload() { spritesheet = loadImage("walk-sprite.png"); } function setup() { createCanvas(600, 600); let w = spritesheet.width / 17; let h = spritesheet.height / 2; for (let y = 0; y < 2; y++) { for (let x = 0; x < 17; x++) { sprites.push(spritesheet.get(x * w, y * h, w, h)); } } x = width / 2; y = height / 2; imageMode(CENTER); } function draw() { background(255); if (automaticMovement) { direction = 1; x += speed; step = (step + 1) % 12; translate(x, y); scale(direction, 1); image(sprites[step], 0, 0); } } function keyPressed() { clearInterval(animationTimer); automaticMovement = true; // then set the interval animationTimer = setInterval(() => { step = (step + 1) % 12; }, stepSpeed); } function keyReleased() { clearInterval(animationTimer); automaticMovement = false; } function mouseClicked() { automaticMovement = true; }