コード例 #1
0
    def __init__(self, ship):
        global HEALTH_IMAGE
        self.ship = ship

        games.Sprite.__init__(self, HEALTH_IMAGE, x=self.ship.x, y=50)

        self.pos = self.left

        self.outline = games.Sprite(BAR_OUTLINE_IMAGE, x=self.x, y=self.y)
        self.bg = games.Sprite(games.scale_image(BAR_BG_IMAGE, 0, 1),
                               x=self.x,
                               y=self.y)
コード例 #2
0
ファイル: vgames.py プロジェクト: DeanChurch1/dropper-game
def main():

    SW = 640
    SH = 480

    games.init(screen_width=SW, screen_height=SH, fps=60)

    #background
    bg_img = games.load_image("sprites/background.jpg", transparent=False)
    games.screen.background = bg_img
    #character
    ch_img = games.load_image("sprites/character.png", transparent=True)
    character = games.Sprite(image=ch_img, x=SW / 3, y=SH / 3)
    games.screen.add(character)

    #present
    present_img = games.load_image("sprites/present.png", transparent=True)

    present = Present(image=present_img,
                      x=SW / 2,
                      y=SH / 2,
                      dx=random.randint(-10, 10),
                      dy=random.randint(-10, 10))
    present2 = Present(image=present_img,
                       x=SW / 2,
                       y=SH / 2,
                       dx=random.randint(-10, 10),
                       dy=random.randint(-10, 10))
    present3 = Present(image=present_img,
                       x=SW / 2,
                       y=SH / 2,
                       dx=random.randint(-10, 10),
                       dy=random.randint(-10, 10))

    #bag
    bag_img = games.load_image("sprites/bag.png", transparent=True)
    bag = Bag(image=bag_img, x=games.mouse.x, y=420)

    #Creating txt object
    score = ScText(value=SCORE,
                   size=60,
                   is_collideable=False,
                   color=color.black,
                   x=550,
                   y=30)

    #Putting objects on screen
    games.screen.add(score)
    games.screen.add(present)
    games.screen.add(present2)
    games.screen.add(present3)
    games.screen.add(bag)

    #makes mouse invisible
    games.mouse.is_visible = False
    #locks screen
    games.screen.event_grab = False

    #starts mainloop
    games.screen.mainloop()
コード例 #3
0
ファイル: main.py プロジェクト: ProxyPylon/Arbuuuz
def main():
    games.init(screen_width=708, screen_height=800, fps=60)

    wall_image = games.load_image("aska2.jpg", transparent=False)
    games.screen.background = wall_image

    arbuz_img = games.load_image("арбуз_120_recoloRED.png", transparent=True)
    ar_1 = games.Sprite(image=arbuz_img, x=160, y=200, dx=4)

    #txt = games.Text(value="123qweasd", size= 80, color=(255, 30, 40), x=350, y=30)
    txt = New_Text(value="123qweasd",
                   size=80,
                   color=(255, 30, 40),
                   x=350,
                   y=30)

    ar_2 = Water_Melon_rand_jump(image=arbuz_img, x=160, y=500, dx=5, dy=3)

    games.screen.add(ar_1)
    games.screen.add(ar_2)
    games.screen.add(txt)

    games.screen.mainloop()
コード例 #4
0
# Moving Pizza
# Demonstrates sprite velocities

from superwires import games

games.init(screen_width=640, screen_height=480, fps=50)

wall_image = games.load_image("wall.jpg", transparent=False)
games.screen.background = wall_image

pizza_image = games.load_image("pizza.bmp")
the_pizza = games.Sprite(image=pizza_image,
                         x=games.screen.width / 2,
                         y=games.screen.height / 2,
                         dx=-1,
                         dy=-1)
games.screen.add(the_pizza)

games.screen.mainloop()
コード例 #5
0
path_to_images = '../../Pictures/img/'

# create a graphic screen 640x480 with 50 fps
games.init(screen_width=640, screen_height=480, fps=50)

# add background
wall_image = games.load_image(path_to_images + "wall.jpg", transparent=False)
games.screen.background = wall_image

# add pizza (sprite)
pizza_image = games.load_image(path_to_images + "pizza.png")
pizza = games.Sprite(
    image=pizza_image,
    # put it in left up corner
    # x = 60,
    # y = 60
    # or make it move
    x=games.screen.width / 2,
    y=games.screen.height / 2,
    dx=1,
    dy=1)
games.screen.add(pizza)

# add scores (text)
score = games.Text(
    value=1753296,
    size=60,
    # color = (0, 0, 0), # RGBA
    color=color.black,  # or use color module
    x=550,
    y=30)
games.screen.add(score)
    plt.title("Error vs No of epochs")
    plt.xlabel("No of Epochs")
    plt.ylabel("Error")
    plt.show()

    print("Completed")
    print("-------------------------------")
    print("\n")

    da.reconstruct(data)


if __name__ == "__main__":
    games.init(screen_width=1000, screen_height=800, fps=50)
    back_image = games.load_image("white_back.jpg", transparent=False)
    games.screen.background = back_image
    auto_image = games.load_image("auto_arch.jpg")
    the_auto = games.Sprite(image=auto_image,
                            x=games.screen.width / 2,
                            y=games.screen.height / 2)
    games.screen.add(the_auto)
    name = games.Text(value="Autoencoders Architecture",
                      size=40,
                      color=color.black,
                      x=games.screen.width / 2 - 40,
                      y=60)
    games.screen.add(name)
    games.screen.mainloop()

    test_dA()
コード例 #7
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Спрайт-пицца
# Демонстрирует создание спрайта
from superwires import games

games.init(screen_width=640, screen_height=480, fps=50)

wall_image = games.load_image("wall.jpg", transparent=False)
games.screen.background = wall_image

pizza_image = games.load_image("pizza.bmp", transparent=True)
pizza = games.Sprite(image=pizza_image,
                     x=games.screen.width / 2,
                     y=games.screen.height / 2)
games.screen.add(pizza)

games.screen.mainloop()
コード例 #8
0
# Pizza Sprite
# Demonstrates creating a sprite 

from superwires import games

games.init(screen_width = 640, screen_height = 480, fps = 50)

wall_image = games.load_image("wall.jpg", transparent = False)
games.screen.background = wall_image

pizza_image = games.load_image("pizza.bmp")
pizza = games.Sprite(image = pizza_image, x = 320, y = 240)
games.screen.add(pizza)

games.screen.mainloop()