您当前的位置: 首页 > 

川川菜鸟

暂无认证

  • 3浏览

    0关注

    969博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

2022虎年烟花代码

川川菜鸟 发布时间:2022-01-25 15:50:55 ,浏览量:3

一、演示效果

b站:虎年烟花演示

二、python代码
import pygame
from math import *
from pygame.locals import *

import random


class firew:
    
    def __init__(self, pos, color, light, size, move):
        self.pos = list(pos)
        self.color = list(color)
        self.light = light
        self.size = size
        
        self.move = list(move)
    
    def force(self, force):
        self.move[0] += force[0]
        self.move[1] += force[1]

        self.move[0] *= force[2]
        self.move[1] *= force[2]
    
    def update(self):
        self.pos[0] += self.move[0]
        self.pos[1] += self.move[1]

    def render(self, fenster, glitter):
        glitter = (glitter and random.randint(40, 100)/100) or 1
        c = rund( mult(self.color, self.light*glitter) )
        rad = int(round(self.light* self.size))
        rad += rad             
关注
打赏
1665165634
查看更多评论
0.1474s