コード例 #1
0
 def explode(self):
     self.amount_count += self.amount
     self.has_finish = False
     for _ in range(self.amount):
         if (self.size == None):
             size = randint(5, 10)
         else:
             size = self.size + randint(-1,1)
         if self.color == None:
             ran = randint(0,3)
             if ran > 1:
                 color = (randint(200, 255), randint(0, 15), randint(0, 15))
             elif ran > 0:
                 color = (randint(240, 255),randint(100, 150),0)
             else:
                 ore = randint(220, 240)
                 color = (randint(240, 255), ore, ore)
         else:
             color = self.color
             
         self.add(particleSystem.Particle(self.pos[0], self.pos[1], 
                         randint(0,360), uniform(1,3), 
                         size, size, color=color, 
                         gravity=True, grav=(0,-0.1)))
     return self
コード例 #2
0
    def draw(self, screen):
        self.count += 1
       
        if (self.size == None):
            size = randint(5, 10)
        else:
            size = self.size + randint(-1,1)
        if self.color == None:
            ran = randint(0,3)
            if ran > 1:
                color = (randint(200, 255), randint(0, 15), randint(0, 15))
            elif ran > 0:
                color = (randint(200, 230),randint(80, 120),0)
            else:
                ore = randint(220, 240)
                color = (randint(240, 255), ore, ore)
        else:
            color = self.color
            
        self.add(particleSystem.Particle(self.pos[0], self.pos[1], 
                        randint(0,360), uniform(1,3), 
                        size, size, color=color, 
                        gravity=True, grav=(0,-0.1)))

        if len(self.sprites()) > self.amount:
            self.remove_first(screen)

        super().draw(screen)
コード例 #3
0
 def explode(self):
     self.amount_count += self.amount
     self.has_finish = False
     for _ in range(self.amount):
         size = randint(-2,2) + self.size
         if self.color == None:
             if randint(0,1) > 0:
                 color = (randint(0, 15),randint(230, 255),randint(0, 15))
             else:
                 color = (randint(230, 255),randint(200, 230),randint(0, 15))
         else:
             color = self.color
             
         self.add(particleSystem.Particle(self.pos[0], self.pos[1], randint(0, 360),
                 randint(1, 4), size, size, color=color, gravity=True))
     return self
コード例 #4
0
 def explode(self, screen):
     self.pos.x = self.sprites()[0].get_pos()[0]
     self.pos.y = self.sprites()[0].get_pos()[1]
     self.empty()
     for _ in range(self.amount):
         size = randint(-2,2) + self.size
         if self.color == None:
             if randint(0,1) > 0:
                 color = (randint(0, 15),randint(230, 255),randint(0, 15))
             else:
                 color = (randint(230, 255),randint(200, 230),randint(0, 15))
         else:
             color = self.color
         p = particleSystem.Particle(self.pos[0], self.pos[1], randint(0, 360),
                 randint(1, 4), size, size, color=color, gravity=True)
         self.add(p)
コード例 #5
0
    def draw(self, screen):
        self.count += 1

        size = randint(3, 10)

        if self.color == None:
            color = (randint(0, 255), randint(0, 255), randint(0, 255))
        else:
            color = self.color

        self.add(particleSystem.Particle(self.pos[0], self.pos[1], randint(
            0, 360), randint(1, 2), size, size, color=color, gravity=self.gravity))

        if self.count >= self.life_time:
            self.remove_first(screen)

        super().draw(screen)
コード例 #6
0
    def __init__(self, x, y, timer=1, amount=20, life_time=4, missile_size=5, particule_size=2,color=None, missile_color=(200, 215, 200), FPS=60, raw=False):
        super().__init__(raw=raw)

        self.pos = pygame.math.Vector2(x, y)
        self.timer = timer*FPS
        self.life_time = life_time*FPS
        self.count = 0
        self.amount = amount
        self.color = color
        self.size = particule_size
        self.has_exploded = False
        self.has_finish = False
        p = particleSystem.Particle(
            self.pos[0], self.pos[1], 
            -90, 15, missile_size, missile_size, 
            color=missile_color, gravity=False)
        self.add(p)
コード例 #7
0
 def explode(self):
     self.amount_count += self.amount
     self.has_finish = False
     for _ in range(self.amount):
         if (self.size == None):
             size = randint(5, 10)
         else:
             size = self.size
         if self.color == None:
             color = (randint(0, 255), randint(0, 255), randint(0, 255))
         else:
             color = self.color
             
         self.add(particleSystem.Particle(self.pos[0], self.pos[1], 
                         randint(0, 360), uniform(3,6), 
                         size, size, color=color, 
                         gravity=False))
     return self
コード例 #8
0
 def explode(self):
     self.amount_count += self.amount
     self.has_finish = False
     for _ in range(self.amount):
         if (self.size == None):
             size = randint(5, 10)
         else:
             size = self.size
         if self.color == None:
             ore = randint(50,120)
             color = (ore, ore, ore)
         else:
             color = self.color
             
         self.add(particleSystem.Particle(self.pos[0], self.pos[1], 
                         randint(-90, 90) -90, uniform(0.5,2), 
                         size, size, color=color, 
                         gravity=False))
     return self
コード例 #9
0
 def explode(self):
     self.amount_count += self.amount
     self.has_finish = False
     for _ in range(self.amount):
         if (self.size == None):
             size = randint(5, 10)
         else:
             size = self.size + randint(-1,1)
         if self.color == None:
             ore = randint(50,200)
             color = (ore, ore, ore)
         else:
             color = self.color
             
         self.add(particleSystem.Particle(self.pos[0], self.pos[1], 
                         randint(-20, 20)-90, uniform(1,4), 
                         size, size, color=color, 
                         gravity=True, grav=(0,-0.05)))
     return self
コード例 #10
0
import mathLib as m
import math
import particleSystem as pS
import UI2 as ui
import pygame
import time
import random

window = ui.NewWindow()

Gravity = 9.8
#standard = 100pixel = 1m
particles = []

while True:
    for i in range(600):
        p = pS.Particle(window.screen, 400 - 7, 300 - 7, 7, 7, (random.randint(
            70, 220), random.randint(70, 220), random.randint(70, 220)), 1)
        particles.append(p)
        p.xv = 9
        p.NewAngle(i)
        p.xv = 1.618 * i
        #p.xv = random.choice([i, -i])

    while True:
        window.NextFrame()
        for i in particles:
            i.Update()