int playerX, playerY; // Player position int targetX, targetY; // Winning posssition int box1X, box1Y; // Box 1 posssition int box2X, box2Y; // Box 2 posssition int box3X, box3Y; // Box 3 posssition int box4X, box4Y; // Box 4 posssition int box5X, box5Y; // Box 5 posssition int box6X, box6Y; // Box 6 posssition int box7X, box7Y; // Box 7 posssition int box8X, box8Y; // Box 8 posssition int box9X, box9Y; // Box 8 posssition int box10X, box10Y; // Box 8 posssition int tileSize = 40; // Size of each box in the maze color playerColor = color(255, 0, 0); // Initial player color (red) color[] boxColors = {#FF0000, #0000FF, #FFFF00, #FFC0CB, #FFA500}; // colors // Maze layout int[][] maze = { {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1}, {1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1}, {1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1}, {1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1}, {1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1}, {1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1}, {1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1}, {1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1}, {1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} }; boolean reachedBox1 = false;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter