junjie 接小球遊戲

2021-10-06 05:39:35 字數 1188 閱讀 4262

import pygame

import random

import time

# python game

# loading... 初始化... 載入中....

pygame.init(

)# 介面遊戲 dis 分開 play玩 diaplay 展覽展示的意思

# set設定 mode模式

chuang_kou = pygame.display.set_mode(

(500

,700))

ballx =

250bally=

350r,g,b =

125,

125,

125banjing =

100while

1>0:

# 控制電腦:按滑鼠,按鍵盤

# 事件 event

for event in pygame.event.get():

print

(event)

# type型別

if event.

type

== pygame.quit:

pygame.quit(

) chuang_kou.fill((1

,1,1

))# ballx = ballx + 1

bally=bally+

1if bally >=

700:

bally=

0 r=random.randint(0,

255)

b = random.randint(0,

255)

g = random.randint(0,

255)

banjing = random.randint(50,

150)

# 畫乙個圓 pygame.draw.circle(視窗, (r,g,b),(x,y),半徑)

pygame.draw.circle(chuang_kou,

(r,g,b )

,(ballx,bally)

,banjing)

# 重新整理 update up向上date日期

# time.sleep(0.1)

pygame.display.update(

)

junjie 接小球遊戲3 0

import pygame import random defqiu bally,speedy,ballx,speedx,r,g,b bally bally speedy ballx ballx speedx if bally 0 speedy 1if ballx chuang kou kuan s...

Bob 雙人接小球遊戲

import pygame import random yihaowanjiadefen 0erhaowanjiadefen 0import time as t defball screen,x,y,down,right,green,speed if down y y speed else y y ...

junjie 猜拳遊戲公升級

字串 字元的集合 單行注釋 多行注釋 法凈寺哦vjoi阿斗 a 12 34 b 12 34 c 12 34 d 12 34 print c 字串的運算 a 3 b 4 print a b s lengt騰h 長度 print len s in print 望著榮耀 in s print 望著榮耀 n...