G11_C1_ForTeacherReference
| Activity Flow | Slide No. | Topic | Time |
|---|---|---|---|
| TA | 4 | Ice-breaker | 1 min |
| 5-12 | Programming Intro | 2 min | |
| 13-16 | Object Oriented Programming | 3 min | |
| 17-22 | Introduction to Python + Spyder + Pygame | 3 min | |
| 23-34 | TA - Coding | 15 min | |
| SA | 35-38 | SA | 5 min |
| Wrap - Up | 39-42 | Quiz | 1 min |
| SA | 43 | Additional Activity | 5 min |
| Slide No. | Topic |
|---|---|
| 12 | Random number code |
| 24-26 | Basic pygame code |
| 32 | Making rectangles |
| 37 | SA Code- Creating ball rect. |
| 44 | Additional Activity- Code |
Computer with an Internet connection.
The latest browser installed.
Spyder IDE.
Projector to present the screen.
1. Computer with an Internet connection.
2. The latest browser installed.
B
B
B
B
B
B
B
B
B
B
B
B
B
import pygame
B
import pygame
pygame.init()import pygame
pygame.init()
screen = pygame.display.set_mode((400,600))B
import pygame
pygame.init()
screen = pygame.display.set_mode((400,600))
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()B
B
import pygame
pygame.init()
screen = pygame.display.set_mode((400,600))
paddle=pygame.Rect(200,500,30,10)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()B
B
B
B
import pygame
pygame.init()
screen = pygame.display.set_mode((400,600))
paddle=pygame.Rect(200,500,30,30)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
pygame.draw.rect(screen,(23,100,100),paddle)
pygame.display.update()B
B
Student activity
Create the rectangle object: pygame.Rect
Draw the created rectangle: pygame.draw.rect
B
import pygame
pygame.init()
screen = pygame.display.set_mode((400,600))
paddle=pygame.Rect(200,500,30,30)
ball=pygame.Rect(70,50,10,10)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
pygame.draw.rect(screen,(23,100,100),paddle)
pygame.draw.rect(screen,(255,255,255),ball)
pygame.display.update()We first pass the surface, then the color, and then the name of the rectangle
RGB stands for red green blue. Each color that we use can be represented as a combination of these 3 colors in varying percentages.
B
Student activity
Create the rectangle object: pygame.Rect
Draw the created rectangle: pygame.draw.rect
RGB for orange:255,69,0
B
import pygame
pygame.init()
screen = pygame.display.set_mode((400,600))
paddle=pygame.Rect(200,500,30,30)
ball=pygame.Rect(70,50,10,10)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
pygame.draw.rect(screen,(23,100,100),paddle)
pygame.draw.rect(screen,(255,69,0),ball)
pygame.display.update()| Activity | Activity Name | Link |
|---|---|---|
| Teacher Activity 1 | Random Number Generation | |
| Teacher Activity 2 | Paddle creation | |
| Teacher Activity 2 (Solution) | Paddle creation | |
| Student Activity 1 | Ball creation | |
| Student Activity 1 (Solution) | Ball creation | |
| Student Additional Activity 1 | Ball creation_AA | |
| Student Additional Activity 1(Solution) | Ball creation_AA |