NaPoWriMo x NaPoGenMo 2024 Day 25 : Poetic Game Prototyping

NaPoWriMo x NaPoGenMo 2024 Day 25 : Poetic Game Prototyping

Poetry as a game

GuessTheRhyme

For the 25th day of NaPoWriMo/NaPoGenMo 2024, "GuessTheRhyme" is coded in P5js and is prototype of a game, where the player tries to guess the scramble rhymes.

Game

https://illestpreacha.itch.io/guesstherhyme

P5JS Code

//medium version


/* 
Hydra: 
s0.initScreen()
src(s0).kaleid(2).rotate(180).scale([0.75,1,1.25]).scrollY(0.4,0.4).out()
speed = 0.5

*/

function setup() {
  createCanvas(800, 800);
}

function draw() {
  word_1 = [
    "fleet",
    "cheat",
    "complete",
    "defeat",
    "feat",
    "sheet",
    "streets",
    "conceit",
    "feet",
    "treat",
    "beat",
    "repeat",
    "drumbeat",
    "excrete",
    "athlete",
    "backseat",
  ];

  rhymes = shuffle(word_1);

  background(220);
  textAlign(CENTER);
  textSize(height / 18);
  frameRate(1);

  shuff(rhymes[0], 0);
  shuff(rhymes[1], 1);
  shuff(rhymes[2], 2);
  shuff(rhymes[3], 3);
  shuff(rhymes[4], 4);
  shuff(rhymes[5], 5);
  shuff(rhymes[6], 6);
  shuff(rhymes[7], 7);
}

function shuff(x, y) {
  // turn the tring into a char array and then shuffled back into a string

  mixed_str = x.split("");
  word = shuffle(mixed_str);
  flipped = word.join("");

  if (flipped == x) {
    fill("red");
  }
  //this checks if the first 3 letters of the flipped and orginal matches
  else if (flipped.substring(0, 2) == x.substring(0, 3)) {
    fill("green");
  }
  //checking if the word ends with t
  else if (flipped.endsWith("t")) {
    fill("blue");
  } else {
    fill("black");
  }
  text(flipped, width / 2, height / 6 + y * (height / 9));
}