
For my third drawing I made pixel art from my favorite arcade game Galaga! I posted the code I made at the bottom of the post.

this will save an SVG file in your download folder
*/
function setup() {
createCanvas(500, 500, SVG); // Create SVG Canvas
strokeWeight(1); // stroke thickness
stroke(255, 0, 0); // red
noFill(); // better not to have a fill for laser
background(‘Black’);
}
function ship(){
baseY = 100;
baseX = 25;
for (i = 5; i < 13; i++) // Left wing
{
rect(0 + baseX, baseY + (i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 9; i < 12; i++)
{
rect(25 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 8; i < 11; i++)
{
rect(50 + baseX, baseY + (i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 3; i < 10; i++)
{
rect(75 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 5; i < 12; i++)
{
rect(100 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 4; i < 12; i++)
{
rect(125 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 0; i < 11; i++)
{
rect(150 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 0; i < 11; i++)
{
rect(200 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 1; i < 16; i++)
{
rect(175 + baseX, (i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 4; i < 12; i++)
{
rect(225 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 5; i < 12; i++)
{
rect(250 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 3; i < 10; i++)
{
rect(275 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 8; i < 11; i++)
{
rect(300 + baseX, baseY + (i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 9; i < 12; i++)
{
rect(325 + baseX, baseY + (i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 5; i < 13; i++)
{
rect(350 + baseX, baseY + (i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
//Blue
for (i = 5; i < 7; i++) // Left wing
{
stroke(‘RoyalBlue’);
rect(0 + baseX, baseY + (i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 3; i < 5; i++)
{
stroke(‘RoyalBlue’);
rect(75 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
stroke(‘RoyalBlue’);
rect(75 + baseX, baseY +(6 * 25), 20, 20);
stroke(‘RoyalBlue’);
rect(100 + baseX, baseY +(5 * 25), 20, 20);
for (i = 10; i < 12; i++)
{
stroke(‘RoyalBlue’);
rect(100 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 9; i < 12; i++)
{
stroke(‘RoyalBlue’);
rect(125 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 6; i < 8; i++)
{
stroke(‘RoyalBlue’);
rect(150 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 6; i < 8; i++)
{
stroke(‘RoyalBlue’);
rect(200 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 9;i < 11;i++)
{
stroke(‘RoyalBlue’);
rect(175 + baseX, (i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 9; i < 12; i++)
{
stroke(‘RoyalBlue’);
rect(225 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 10; i < 12; i++)
{
stroke(‘RoyalBlue’);
rect(250 + baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
stroke(‘RoyalBlue’);
rect(275+ baseX, baseY +(6 * 25), 20, 20);
stroke(‘RoyalBlue’);
rect(250 + baseX, baseY +(5 * 25), 20, 20);
for (i = 3; i < 5; i++) // Left wing
{
stroke(‘RoyalBlue’);
rect(275 + baseX, baseY + (i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
for (i = 5; i < 7; i++)
{
stroke(‘RoyalBlue’);
rect(350+ baseX, baseY +(i * 25), 20, 20);
// x location, y location, width, height
rotate(0);
}
}
function draw() {
ship();
noLoop(); // we just want to export once
}
RA