Code Sketch


frod link
By: Mhalsakant School
// --- iPhone 17 Lottery Scam & Awareness Simulator in Kojo ---
clear()
setBackground(Color(12, 18, 30))

// ????? ?????????
var isClicked = false
var bankBalance = 500000
var flashEffect = 0
var alarmTimer = 0

def drawiPhoneScamScene(): Unit = {
  erasePictures()

  // 1. ?????????? ????? ??????
  for (i <- -250 to 250 by 80) {
    val line = Picture.rectangle(600, 1)
    line.setFillColor(Color(25, 35, 55))
    line.setPosition(-300, i.toDouble)
    draw(line)
  }

  // 2. iPhone 17 ?? 3D ????? (Futuristic Phone Body)
  val phoneBody = Picture.rectangle(170, 310)
  phoneBody.setFillColor(Color(20, 25, 35))
  phoneBody.setPenColor(Color(180, 200, 220)) // Titanium Frame
  phoneBody.setPenThickness(4)
  phoneBody.setPosition(-190, -130)
  draw(phoneBody)

  // iPhone 17 Screen
  val phoneScreen = Picture.rectangle(156, 296)
  phoneScreen.setFillColor(if (isClicked) Color(40, 10, 15) else Color(10, 20, 35))
  phoneScreen.setPosition(-183, -123)
  draw(phoneScreen)

  // Dynamic Island (iPhone Notch)
  val notch = Picture.rectangle(40, 10)
  notch.setFillColor(Color(0, 0, 0))
  notch.setPosition(-125, 155)
  draw(notch)

  // 3. iPhone ???? ?????????? ????? (Fraud Message)
  val msgBox = Picture.rectangle(140, 90)
  msgBox.setFillColor(if (isClicked) Color(100, 20, 20) else Color(30, 45, 75))
  msgBox.setPenColor(if (isClicked) Color(255, 50, 50) else Color(0, 255, 200))
  msgBox.setPenThickness(2)
  msgBox.setPosition(-175, 20)
  draw(msgBox)

  if (!isClicked) {
    val t1 = Picture.text("? iPhone 17 Alert", 10)
    t1.setPenColor(Color(255, 215, 0))
    t1.setPosition(-170, 90)
    draw(t1)

    val t2 = Picture.text("? CONGRATS!", 11)
    t2.setPenColor(Color(0, 255, 200))
    t2.setPosition(-165, 70)
    draw(t2)

    val t3 = Picture.text("CLICK TO CLAIM", 10)
    t3.setPenColor(Color(255, 255, 255))
    t3.setPosition(-168, 50)
    draw(t3)

    val t4 = Picture.text("?5,00,000 LOTTERY!", 10)
    t4.setPenColor(Color(255, 215, 0))
    t4.setPosition(-170, 32)
    draw(t4)
  } else {
    val e1 = Picture.text("? WARNING ?", 11)
    e1.setPenColor(Color(255, 50, 50))
    e1.setPosition(-165, 85)
    draw(e1)

    val e2 = Picture.text("FRAUD DETECTED!", 10)
    e2.setPenColor(Color(255, 255, 255))
    e2.setPosition(-170, 65)
    draw(e2)

    val e3 = Picture.text("ALL BANK MONEY", 10)
    e3.setPenColor(Color(255, 100, 100))
    e3.setPosition(-170, 45)
    draw(e3)

    val e4 = Picture.text("STOLEN! ?0", 11)
    e4.setPenColor(Color(255, 0, 0))
    e4.setPosition(-155, 28)
    draw(e4)
  }

  // ??? ?????? ????????
  val bankHUD = Picture.text(s"BANK BAL: ?$bankBalance", 12)
  bankHUD.setPenColor(if (isClicked) Color(255, 50, 50) else Color(0, 255, 100))
  bankHUD.setPosition(-170, -100)
  draw(bankHUD)

  // 4. ?????? ?????????? ????? (Smart Teacher / Cyber Expert character)
  // ????
  val head = Picture.circle(25)
  head.setFillColor(Color(255, 205, 165))
  head.setPosition(120, 60)
  draw(head)

  // ????? (Glasses)
  val glassL = Picture.circle(7)
  glassL.setPenColor(Color(0, 0, 0))
  glassL.setPosition(110, 65)
  draw(glassL)

  val glassR = Picture.circle(7)
  glassR.setPenColor(Color(0, 0, 0))
  glassR.setPosition(130, 65)
  draw(glassR)

  // ???? (Coat)
  val body = Picture.rectangle(50, 80)
  body.setFillColor(Color(30, 70, 150))
  body.setPosition(95, -20)
  draw(body)

  // 5. ??????? ?????? ????? (Advice Speech Bubble)
  val bubble = Picture.rectangle(230, 100)
  bubble.setFillColor(Color(255, 255, 255))
  bubble.setPenColor(Color(0, 255, 200))
  bubble.setPenThickness(2)
  bubble.setPosition(20, 110)
  draw(bubble)

  val m1 = Picture.text("??? ?????????? ??? (LESSON):", 12)
  m1.setPenColor(Color(0, 100, 200))
  m1.setPosition(30, 185)
  draw(m1)

  val m2 = Picture.text("????? ???????? ??????", 11)
  m2.setPenColor(Color(200, 0, 0))
  m2.setPosition(30, 165)
  draw(m2)

  val m3 = Picture.text("(FRAUD) ????? ????? ??????", 11)
  m3.setPenColor(Color(200, 0, 0))
  m3.setPosition(30, 145)
  draw(m3)

  val m4 = Picture.text("??? ???? ???! ???? ????!", 12)
  m4.setPenColor(Color(0, 150, 0))
  m4.setPosition(30, 122)
  draw(m4)

  // ??? ?????
  val title = Picture.text("? iPhone 17 FRAUD AWARENESS ?", 16)
  title.setPenColor(Color(0, 255, 200))
  title.setPosition(-170, 215)
  draw(title)

  val hint = Picture.text("[ iPhone ???? ? ????????? ??????? ?????? ????? ??? ]", 11)
  hint.setPenColor(Color(200, 200, 200))
  hint.setPosition(-160, -220)
  draw(hint)

  // 6. ??? ?????? ?????
  if (flashEffect > 0) {
    val flash = Picture.rectangle(600, 500)
    flash.setFillColor(Color(255, 0, 0))
    flash.setPosition(-300, -250)
    draw(flash)
    flashEffect -= 1
  }
}

drawiPhoneScamScene()

// ????????? ???
animateWithState(0.0) { frame =>
  if (isClicked) {
    alarmTimer += 1
    if (alarmTimer % 12 == 0) {
      playNote(88, 80) // Alert Sound
      playNote(65, 80)
    }
  }
  drawiPhoneScamScene()
  frame + 1.0
}

// iPhone 17 ???? ??????? ????? ???????? ????? ????
onMouseClick { (x, y) =>
  if (x > -180 && x < -30 && y > 10 && y < 110) {
    if (!isClicked) {
      isClicked = true
      bankBalance = 0 // ??? ????????? ???? ? ??? ????? ????!
      flashEffect = 2 // ??? ?????
    }
  }
}