1- Min Golf-Setting Up the Canvas
 
Mini Golf Game - Stage 1 Complete Guide
šŸŽ“ 8th Grade Computer Science Lesson

⛳ Mini Golf Game Setup

Stage 1: Setting Up the Canvas Program

šŸŽÆ My Objectives

1. I will apply my coding skills to make a canvas that runs my Mini Golf game smoothly.
2. I will apply and analyze how the setup and draw functions work together to build my Mini Golf canvas.

šŸ’­ Question of the Day

"How is programming a video game similar to writing a story?"

Select the BEST answer:

šŸ“ Canvas Assignment: After selecting your answer, write a 3-5 sentence explanation of your choice in today's Canvas post. Explain why you chose that answer and give specific examples!

šŸ› Fun Fact Question of the Day!

"Why do programmers prefer dark mode?"

šŸ’” Did You Know?
In programming, "bugs" are errors in code. The term dates back to 1947 when an actual moth was found causing problems in a computer at Harvard University! So the joke is that "light attracts bugs" - both the insect kind AND the code error kind! šŸ›
šŸ“ Canvas Assignment: Write your answer choice AND explain in 2-3 sentences why this joke is funny (even if you didn't laugh!) in today's Canvas post.

šŸŽ„ Watch First: Video Tutorial

Introduction to p5play - Canvas Setup

Before you start coding, watch this CodeHS video to see how setup() and draw() work in action!

šŸ“ŗ Duration: 5-8 minutes

šŸ“š Topics: Canvas creation, setup() and draw() functions, backgrounds

šŸŽ¬ Watch Video on CodeHS

āš ļø Important: After watching, complete the step-by-step instructions below!

šŸ“‹ Step-by-Step Instructions

Follow each step carefully to build the foundation of your Mini Golf game. Check off each box as you complete it!

1
Create the Program Structure
function setup() {
}

function draw() {
}
āœļø Note: The setup() function runs once at the start, while draw() repeats every frame.
2
Create the Canvas
function setup() {
  new Canvas(450, 520);
}
3
Add a Background Color
function draw() {
  clear();
  background("#79bef2");
}
šŸŽØ Color Tip: You can use hex codes (#79bef2), color names ('blue'), or RGB values!
4
Add Mouse Coordinates
let coordinates;
function setup() {
  new Canvas(450, 520);
  mouseCoordinates();
}
function draw() {
  clear();
  background("#79bef2");
  coordinates.text = round(mouse.x, 1) + ', ' + round(mouse.y, 1);
}
function mouseCoordinates() {
  coordinates = new Sprite();
  coordinates.color = 'white';
  coordinates.width = 80;
  coordinates.height = 20;
  coordinates.x = width - coordinates.width / 2 - 5;
  coordinates.y = coordinates.height / 2 + 5;
  coordinates.collider = 'none';
}
🧠 Think About It: What do these numbers in this function represent? Write your response in your notes. Be ready to share later!
5
Test and Reflect
āœ… Mini Golf Setup Complete!

šŸ’” Reflection Questions

āœ… Student Checklist Review

Task Completed (Yes/No) Your Initials
Program structure created
Canvas created & visible
Background color added
(Optional) Mouse coordinates display
Reflection questions completed

šŸ“ Don't Forget Canvas!

Before moving to the quiz, make sure you've posted your responses to today's Canvas assignment:

āœ“ Question of the Day answer with explanation (3-5 sentences)

āœ“ Fun Fact answer with explanation (2-3 sentences)

Ready? Scroll down to take the quiz! šŸŽÆ

Last updated  2025/10/12 01:22:19 PDTHits  60