

Creare un gioco con pygame in python
Presentation
•
Computers
•
11th Grade
•
Practice Problem
•
Hard
Lucia Intelisano
FREE Resource
6 Slides • 0 Questions
1
Come sviluppare un gioco in Python
2
Installare pygame
Python fornisce una libreria integrata chiamata pygame, utilizzata per sviluppare giochi.
Apri il terminale della riga di comando e digita il seguente comando per installare pygame.
pip install pygame
3
Semplice esempio di Pygame
import pygame
pygame.init()
screen = pygame.display.set_mode((400,500))
done = False
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
pygame.display.flip()
4
Semplice esempio di Pygame
import pygame - È il modulo che ci permette di lavorare con tutte le funzioni di pygame.
pygame.init() - Viene utilizzato per inizializzare tutti i moduli richiesti di pygame.
pygame.display.set_mode((width, height)) - Viene utilizzato per ridimensionare le dimensioni della finestra. Restituirà l'oggetto superficie. L'oggetto superficie viene utilizzato per eseguire operazioni grafiche.
pygame.event.get() - Rende vuota la coda degli eventi. Se non lo chiamiamo, i messaggi della finestra inizieranno ad accumularsi e il gioco non risponderà secondo l'opinione del sistema operativo.
pygame.QUIT - Viene utilizzato per chiudere l'evento quando si fa clic sul pulsante a forma di croce nell'angolo della finestra.
pygame.display.flip() - Viene utilizzato per riflettere qualsiasi aggiornamento al gioco. Se apportiamo modifiche, dobbiamo chiamare la funzione display.flip().
5
Semplice esempio di Pygame
import pygame - È il modulo che ci permette di lavorare con tutte le funzioni di pygame.
pygame.init() - Viene utilizzato per inizializzare tutti i moduli richiesti di pygame.
pygame.display.set_mode((width, height)) - Viene utilizzato per ridimensionare le dimensioni della finestra. Restituirà l'oggetto superficie. L'oggetto superficie viene utilizzato per eseguire operazioni grafiche.
pygame.event.get() - Rende vuota la coda degli eventi. Se non lo chiamiamo, i messaggi della finestra inizieranno ad accumularsi e il gioco non risponderà secondo l'opinione del sistema operativo.
pygame.QUIT - Viene utilizzato per chiudere l'evento quando si fa clic sul pulsante a forma di croce nell'angolo della finestra.
pygame.display.flip() - Viene utilizzato per riflettere qualsiasi aggiornamento al gioco. Se apportiamo modifiche, dobbiamo chiamare la funzione display.flip().
Come sviluppare un gioco in Python
Show answer
Auto Play
Slide 1 / 6
SLIDE
Similar Resources on Wayground
5 questions
Distance, speed, time
Presentation
•
5th Grade
9 questions
FIFA Football
Presentation
•
KG
4 questions
Pengenalan alat laboratorium kimia
Presentation
•
10th Grade
7 questions
Understanding the Self
Presentation
•
12th Grade
9 questions
Números Binarios
Presentation
•
11th Grade
5 questions
PH-A Distribusi Binomial
Presentation
•
12th Grade
5 questions
Bahasa Indonesia
Presentation
•
12th Grade
5 questions
Program Linear
Presentation
•
11th Grade
Popular Resources on Wayground
20 questions
"What is the question asking??" Grades 3-5
Quiz
•
1st - 5th Grade
20 questions
“What is the question asking??” Grades 6-8
Quiz
•
6th - 8th Grade
10 questions
Fire Safety Quiz
Quiz
•
12th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
34 questions
STAAR Review 6th - 8th grade Reading Part 1
Quiz
•
6th - 8th Grade
20 questions
“What is the question asking??” English I-II
Quiz
•
9th - 12th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
47 questions
8th Grade Reading STAAR Ultimate Review!
Quiz
•
8th Grade
Discover more resources for Computers
20 questions
“What is the question asking??” English I-II
Quiz
•
9th - 12th Grade
10 questions
Fire Prevention
Quiz
•
9th - 12th Grade
41 questions
US History STAAR Review
Quiz
•
11th Grade
20 questions
Grammar
Quiz
•
9th - 12th Grade
16 questions
AP Biology: Unit 1 Review (CED)
Quiz
•
9th - 12th Grade
20 questions
verbos reflexivos en español
Quiz
•
9th - 12th Grade
20 questions
US History EOC STAAR 2022 Review Set 1
Quiz
•
11th Grade
11 questions
Expectations Review
Quiz
•
9th - 12th Grade