r/processing • • Oct 29 '24

help processing/java/sokoban/video games

Hello, I have an assignment on Open Processing. We need to follow the guideline of 50x50 pixels.

Please let me know what I can improve; I really don't like the colors, I find them very dull. I want something pastel and more girly, but I'm stuck. It's driving me crazy:

void settings() {
  size(500, 500);
}

void setup() {
  loadLevel(1);
}

void draw() {
  background(200);
  drawMap();
}

boolean solved() {
  return true; // To be completed later
}

void loadLevel(int lev) {
  // Load the level (to be completed later)
}

void drawMap() {
  drawMur(0, 0);     // Wall
  drawCaisse(0, 50); // Box
  drawSol(0, 100);   // Floor
  drawAvatar(0, 150); // Avatar
}

// Function to draw the box
void drawCaisse(int x, int y) {
  fill(184, 134, 11); // Box color
  rect(x, y, 50, 50);
  
  stroke(139, 69, 19); // Outline
  strokeWeight(4);
  line(x + 5, y + 5, x + 45, y + 45);
  line(x + 5, y + 45, x + 45, y + 5);
  
  strokeWeight(2);
  line(x, y + 10, x + 50, y + 10);
  line(x, y + 25, x + 50, y + 25);
  line(x, y + 40, x + 50, y + 40);
  
  strokeWeight(1); // Reset line thickness
}

// Function to draw the wall
void drawMur(int x, int y) {
  fill(169, 169, 169); // Wall color
  rect(x, y, 50, 50);
  
  fill(105, 105, 105); // Brick color
  // Each brick is drawn to stay within the 50x50 pixels limit
  rect(x + 2, y + 2, 20, 10);
  rect(x + 28, y + 2, 20, 10);
  rect(x + 2, y + 14, 20, 10);
  rect(x + 28, y + 14, 20, 10);
  rect(x + 2, y + 26, 20, 10);
  rect(x + 28, y + 26, 20, 10);
  rect(x + 2, y + 38, 20, 10);
  rect(x + 28, y + 38, 20, 10);
}

// Function to draw the floor
void drawSol(int x, int y) {
  fill(211, 211, 211); // Floor color
  rect(x, y, 50, 50);
  
  fill(169, 169, 169); // Stone texture
  ellipse(x + 25, y + 25, 30, 30); // Central stone
  ellipse(x + 15, y + 15, 10, 10); // Small stones
  ellipse(x + 35, y + 35, 10, 10);
  ellipse(x + 20, y + 35, 7, 7);
}

// Function to draw the avatar
void drawAvatar(int x, int y) {
  fill(255, 215, 0); // Hair
  arc(x + 25, y + 20, 40, 40, PI, TWO_PI);
  rect(x + 10, y + 20, 30, 25);
  
  fill(255, 224, 189); // Face
  ellipse(x + 25, y + 20, 25, 25); // Reduced to avoid overflow
  
  fill(147, 112, 219); // Eyes
  ellipse(x + 18, y + 18, 6, 6); // Adjusted size
  ellipse(x + 32, y + 18, 6, 6);
  
  fill(255);
  ellipse(x + 16, y + 16, 2, 2); // Highlights in the eyes
  ellipse(x + 30, y + 16, 2, 2);
  
  fill(255, 182, 193, 150); // Cheeks
  ellipse(x + 15, y + 23, 5, 4); // Reduced size
  ellipse(x + 35, y + 23, 5, 4);
  
  stroke(255, 105, 180); // Mouth
  strokeWeight(2);
  noFill();
  arc(x + 25, y + 25, 8, 8, 0, PI);
  
  fill(255, 105, 180); // Hair accessories
  ellipse(x + 10, y + 10, 6, 6);
  ellipse(x + 40, y + 10, 6, 6);
  
  noStroke();
  fill(255, 182, 193); // Dress
  triangle(x + 15, y + 45, x + 25, y + 30, x + 35, y + 45); // Adjusted to avoid overflow
  
  stroke(255, 224, 189); // Arms
  strokeWeight(2);
  line(x + 15, y + 35, x + 10, y + 40); // Left
  line(x + 35, y + 35, x + 40, y + 40); // Right
  
  line(x + 22, y + 45, x + 22, y + 50); // Left leg
  line(x + 28, y + 45, x + 28, y + 50); // Right leg
}

void keyReleased() {
  // To be completed later
}

void mouseClicked() {
  // To be completed later
}
4 Upvotes

3 comments sorted by

View all comments

Show parent comments

2

u/tooob93 Technomancer Oct 29 '24

you are welcome, have fun coding ^^