Exemplo n.º 1
0
 def on_create(self):
     self.lw = w.create_label()
     self.lw.color = Color.random_rgb()
     self.lw.font_size = 40
     self.lw.font = "Comic Sans MS"
     self.color = Color.random_rgb()
     self.score = 0
Exemplo n.º 2
0
 def on_create(self):
     self.add_tag('bb')
     self.position = player.position
     self.scale = 10
     self.color = Color.random_rgb()
     self.speed = 10
     self.point_toward_mouse_cursor()
Exemplo n.º 3
0
    def on_update(self, dt):
        if window.get_key_up(KeyCode.SPACE):
            self.color = Color.BLACK

        if window.get_key_up(KeyCode.ENTER) and self.color == task.color:
            print(self.color)
            task.create_color()
            self.color = Color(0, 0, 0)
Exemplo n.º 4
0
 def draw_rect(self, width, height):
     # self.draw_forward(width)
     # self.rotation += 90
     # self.draw_forward(height)
     # self.rotation += 90
     # self.draw_forward(width)
     # self.rotation += 90
     # self.draw_forward(height)
     # self.rotation += 90
     w.create_rect(self.x, self.y, width, height, color=Color.random_rgb())
Exemplo n.º 5
0
 def create_color(self):
     c1 = random.choice(color_list)
     c2 = random.choice(color_list)
     while c2.color.r == c1.color.r:
         c2 = random.choice(color_list)
     r, g, b = c1.color
     r += c2.color.r
     g += c2.color.g
     b += c2.color.b
     self.color = Color(r / 2, g / 2, b / 2)
Exemplo n.º 6
0
    def on_left_click(self):
        if self.touching_sprite(brush):

            if self.color == Color.BLACK:
                self.color = brush.color
            else:
                r, g, b = self.color
                r += brush.color.r
                g += brush.color.g
                b += brush.color.b
                self.color = Color(r / 2, g / 2, b / 2)
Exemplo n.º 7
0
 def set_color(self, max, min):
     scale = (self.value - min) / (max - min)
     self.color = Color(255, (1 - scale) * 255, (1 - scale) * 255)
Exemplo n.º 8
0
from pycat.core import Window, Sprite, Color
from random import randint

window = Window()
s = window.create_sprite()


class Bat(Sprite):
    def on_create(self):
        s.image = "bat-b.png"
        self.goto_random_position()

s1 = window.create_sprite(Bat)
s2 = window.create_sprite(Bat)
s3 = window.create_sprite(Bat)
for i in range(200):
    s = window.create_sprite(Bat)
    s.opacity = 200
    s.color = Color.random_rgb()
    s.rotation = randint(0,360)
    s.width = randint(0,10)
    s.height = randint(5,10)




window.run()
Exemplo n.º 9
0
 def on_create(self):
     self.height = 70
     self.width = 70
     self.color = Color(0, 0, 225)
Exemplo n.º 10
0
 def set_color(self, min, max):
     scale = (self.value - min) / (max - min)
     self.color = Color((1 - scale) * 225, (1 - scale) * 225, 225)
Exemplo n.º 11
0
 def on_create(self):
     self.goto_random_position()
     self.color = Color.random_rgb()
     self.scale = randint(20, 160)
Exemplo n.º 12
0
 def draw_forward(self, res):
     rest = res
     x1 = self.x
     y1 = self.y
     self.move_forward(rest)
     w.create_line(x1, y1, self.x, self.y, color=Color.random_rgb())
Exemplo n.º 13
0
                self.y += self.speed
            if window.get_key(KeyCode.A):
                self.x -= self.speed
            if window.get_key(KeyCode.S):
                self.y -= self.speed
            if window.get_key(KeyCode.D):
                self.x += self.speed

    def on_left_click(self):
        for c in color_list:
            c.is_selected_color = False
        self.is_selected_color = True


color_r = window.create_sprite(ColorSprite)
color_r.color = Color(255, 0, 0)
color_r.x = 100

color_g = window.create_sprite(ColorSprite)
color_g.color = Color(0, 255, 0)
color_g.x = 300

color_b = window.create_sprite(ColorSprite)
color_b.color = Color(0, 0, 255)
color_b.x = 500

color_bl = window.create_sprite(ColorSprite)
color_bl.color = Color(0, 0, 0)
color_bl.x = 700

color_list = [color_r, color_g, color_b, color_bl]
Exemplo n.º 14
0
 def on_create(self):
     self.add_tag('particle')
     self.color = Color.random_rgb()
     self.goto_random_position()
     self.rotation = random.randint(0,360)
     self.scale = 2