基础DAY14-飞机大战-创建游戏主窗口

python -m pygame.examples.aliens

import pygame
pygame.init()
# 编写邮箱代码
print("游戏代码")
pygame.quit()
初始化和退出

 

import pygame
# 定义hero_rect矩形描述英雄的位置和大小
hero_rect = pygame.Rect(100, 500, 120, 125)
# 输出英雄的坐标原点(x 和 y)
print("英雄的原点%d %d" % (hero_rect.x, hero_rect.y))
# 输出英雄的尺寸(宽度和高度)
print(hero_rect.size)
print("英雄的尺寸%d %d" % hero_rect.size)
print("英雄的尺寸%d %d" % (hero_rect.width, hero_rect.height))
size属性是一个元组,返回第一个值是矩形宽,第二个值是高

import pygame
pygame.init()
# 创建游戏窗口
screen = pygame.display.set_mode((480, 700))
pygame.display.update()
while True:
    pass
pygame.quit()
空窗口

 

转载于:https://www.cnblogs.com/joycezhou/p/11420930.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值