Skip to main content

Command Palette

Search for a command to run...

GameDev_OptionsOptionsOptions

Remixing a previous Game

Updated
2 min read
GameDev_OptionsOptionsOptions

DontClickTheBackground2

For the Game Jam, "TweetTweetJam 10": https://itch.io/jam/tweettweetjam-10, I coded two clicker games in P5js that followed the under 500 code character limit In both games. The objective is to not click background, only the movingthe squares.

For The Game Jam. "OptionsOptionsOptions": https://itch.io/jam/megamitts-mega-jam-15, I will be implementing elements from both games to give the user "options" to click on and play the experience.

https://illestpreacha.itch.io/dont-click-the-background-2

https://blog.illestpreacha.com/gamedevtweettweetjam10

Code

let song;

(setup = (e) => {
  (x = 250), createCanvas(4 * x, 4 * x), (s = 0), (t = 0);
}),
  (draw = (a) => {
  
 
  
//Glitchy Feeling
   glitcher = [1,2,3,4,5,6]
  frameRate(abs((sin(second())*15)+1)*glitcher[second() % 6])
 
  
  //palette
  arr_color = ['white','grey','green']
  arr_color1 = ['blue','aqua','teal']
  arr_color2 = ['tan','brown','maroon']
  arr_color3 = ['red','pink','lime']
  

  
    background("black"),
      fill(arr_color3[second()%3]),
      (d = (x * sin(t)) / 2 + 180),
      (e = x * cos(0.2 * t) + 150)
      
      for(let x = 0; x <= 250; x += 50) {
      square(d + Math.cbrt(x), e, 45),
      fill(arr_color1[second()%3]),
      square(e, e + x*x, 35),
      fill(arr_color2[second()%3]),
      square(e + x, d + x, 45),
      fill("orange"),
      square(d + x, d+ x, 45),
      //White Squares
      fill(arr_color[second()%3]),
      square(
        d + Math.hypot(second() % 7 + x, sin(second())) * 6,
        Math.hypot(second() % 7, sin(second())) * 6,
        45
      ),
      square(
        e + Math.hypot(second() % 7, sin(second())) * 6 + x,
        Math.cbrt(e) * d,
        45
      ),
      square(
        e + Math.hypot(second() % 7, cos(second())) * 6,
        Math.cbrt(e) * e,
        45
      );
      }
  
    textSize(24), text("Click: " + shuffler(),3 * x, 3 * x),(t += 0.1);
    textSize(24), text('Score: ' + s, 3 * x, 3 * x + 24), (t += 0.1);
  }),
  (mousePressed = (e) => {
    (c = get(mouseX, mouseY).join()), print(c) , "0,0,0,255" != c ? s++ : s--;
  });

function keyPressed() {
  if (key === "s") {
    saveFrames("frame", "png", 1, 2);
  }
}

function keyPressed() {
  if (key === "b") {
    saveGif("mySketch", 5);
  }
}

function shuffler(){
    // Joining Arrays of Colors
  arrColor = [...arr_color,...arr_color1,...arr_color2,...arr_color3]; 
  
  //shuffler between random and time, giving options
  arrColor1 = shuffle(arrColor)
  
  if (second() % 8 > 4)
  {
     return arrColor1[0] 
  }else{
    return arrColor[second() % 12]
  }

}

More from this blog