1 Star 2 Fork 0

Johnson_Li/Red_and_Blue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
redbullet.py 738 Bytes
一键复制 编辑 原始数据 按行查看 历史
# -*- coding: UTF-8 -*-
import pygame as pg
from pygame.sprite import Sprite
class Redbullet(Sprite):
def __init__(self, setting, screen, red):
super().__init__()
self.screen = screen
self.rect = pg.Rect(0, 0, setting.redbullet_width, setting.redbullet_height)
# self.rect.centers = red.rect.centerx
self.rect.centery = red.rect.centery
self.rect.left = red.rect.right
self.x = float(self.rect.x)
self.color = setting.redbullet_color
self.speed = setting.redbullet_speed * setting.fps / 500
def update(self):
self.x += self.speed
self.rect.x = self.x
def draw_bullet(self):
pg.draw.rect(self.screen, self.color, self.rect)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/JohnsonLi06/Red_and_Blue.git
git@gitee.com:JohnsonLi06/Red_and_Blue.git
JohnsonLi06
Red_and_Blue
Red_and_Blue
main

搜索帮助