예제 #1
0
파일: object.py 프로젝트: StetHD/sanaviron
    def __init__(self):
        # self.id = random.uniform(0, 999999999)
        Rectangle.__init__(self)
        self.handler = Handler()
        self.magnetos = Magnetos()
        self.offset = Point()
        self.pivot = Point()
        self.selected = False
        self.resizing = False
        self.direction = NONE
        self.control = AUTOMATIC
        self.z = 0

        self.hints = False
        from ui.canvas import Canvas

        self.canvas = Canvas()
        self.handler.is_testing = self.canvas.is_testing

        self.dash = []
        self.thickness = 1.0

        self.fill_style = COLOR
        self.fill_color = Color(0.25, 0.25, 0.25, 0.25)
        self.stroke_color = Color(0.25, 0.25, 0.25, 1.0)
        self.gradient = Gradient()
예제 #2
0
    def __init__(self):
        #self.id = random.uniform(0, 999999999)
        Rectangle.__init__(self)
        self.handler = Handler()
        self.magnetos = Magnetos()
        self.offset = Point()
        self.pivot = Point()
        self.selected = False
        self.resizing = False
        self.direction = NONE
        self.control = AUTOMATIC
        self.z = 0

        self.hints = False
        from ui.canvas import Canvas
        self.canvas = Canvas()
        self.handler.is_testing = self.canvas.is_testing

        self.dash = []
        self.thickness = 1.0

        self.fill_style = COLOR
        self.fill_color = Color(0.25, 0.25, 0.25, 0.25)
        self.stroke_color = Color(0.25, 0.25, 0.25, 1.0)
        self.gradient = Gradient()
예제 #3
0
    def __init__(self):
        Rectangle.__init__(self)
        self.hidden = False
        self.position = 0.0
        self.direction = NONE

        self.control = Control()
        self.control.limbus = True
예제 #4
0
    def __init__(self):
        Rectangle.__init__(self)
        self.hidden = False
        self.position = 0.0
        self.direction = NONE

        self.control = Control()
        self.control.limbus = True
예제 #5
0
    def __init__(self, name, pos, width, height, color):
        """
        Initialize Block.

        Args:
            pos (tuple): Position of the block.
            width ([type]): Width of the block.
            height ([type]): Height of the block.
            color ([type]): Color of the block.
        """
        pygame.sprite.Sprite.__init__(self)
        Rectangle.__init__(self, name,  pos, width, height, color)

        self.solid = True
예제 #6
0
    def __init__(self):
        Rectangle.__init__(self)
        self.active = True
        self.top = 0
        self.left = 0
        self.bottom = 0
        self.right = 0
        self.control = list()

        index = 0
        while index < 8:
            control = Control()
            self.control.append(control)
            index += 1
예제 #7
0
    def __init__(self):
        Rectangle.__init__(self)
        self.active = True
        self.top = 0
        self.left = 0
        self.bottom = 0
        self.right = 0
        self.control = list()

        index = 0
        while index < 8:
            control = Control()
            self.control.append(control)
            index += 1
예제 #8
0
    def __init__(self, name, pos, width, height, color):
        """
        Initialize Coin.

        Args:
            pos (tuple): Position of the coin.
            width ([type]): Width of the coin.
            height ([type]): Height of the coin.
            color ([type]): Color of the coin.
        """
        pygame.sprite.Sprite.__init__(self)
        Rectangle.__init__(self, name, pos, width, height, color)

        self.coin = True
        self.instanceGroup = None
예제 #9
0
 def __init__(self, side):
     Rectangle.__init__(self, side, side)
예제 #10
0
 def __init__(self):
     Rectangle.__init__(self)
     self.active = True
     self.size = 15.0
     self.snap = True
예제 #11
0
 def __init__(self):
     Rectangle.__init__(self)
     self.position = 0
     self.selected = False
     self.size = 25
     self.orientation = NONE
예제 #12
0
 def __init__(self):
     Rectangle.__init__(self)
     self.position = 0
     self.selected = False
     self.size = 25
     self.orientation = NONE
예제 #13
0
 def __init__(self, shape):
     Rectangle.__init__(self, shape)
     StraightShape.__init__(self, shape)
예제 #14
0
 def __init__(self, x, y, size, color):
     Rectangle.__init__(self, x, y, size, size, color)
예제 #15
0
 def __init__(self):
     Rectangle.__init__(self)
     self.active = False
예제 #16
0
파일: square.py 프로젝트: ntmk/ICS-Labs
 def __init__(self, centre_x, centre_y, side, name='Square'):
     Rectangle.__init__(self, centre_x, centre_y, side, side, name)
예제 #17
0
 def __init__(self, x: int, y: int, size: int, color: SDL_Color):
     Rectangle.__init__(self, x, y, size, size, color)
     self._default_color = color
예제 #18
0
 def __init__(self, index, x, y, width, height):
     self.index = index
     self.state = ' '
     Rectangle.__init__(self, x, y, width, height)
예제 #19
0
 def __init__(self):
     Rectangle.__init__(self)
     self.active = True
     self.tags = list()
     self.magnetism = 32
예제 #20
0
 def __init__(self, index, x, y, width, height):
     self.index = index
     self.state = ' '
     Rectangle.__init__(self, x, y, width, height)
예제 #21
0
파일: unit.py 프로젝트: samyzaf/edueda
 def __init__(self, name, x1, y1, x2, y2):
     Rectangle.__init__(self, x1, y1, x2, y2)
     self.name = name
예제 #22
0
 def __init__(self):
     Rectangle.__init__(self)
     self.active = True
     self.tags = list()
     self.magnetism = 32
예제 #23
0
파일: grid.py 프로젝트: StetHD/sanaviron
 def __init__(self):
     Rectangle.__init__(self)
     self.active = True
     self.size = 15.0
     self.snap = True
 def __init__(self, name, x, y, z, width, height, depth):
     Rectangle.__init__(self, name, x, y, width, height)
     self._z = z
     self._depth = depth
예제 #25
0
    def __init__(self, name, pos, width, height, color, room):
        """
        Initialize Player.

        Args:
            pos(tuple): Position of the Player.
            width([type]): Width of the Player.
            height([type]): Height of the Player.
            color([type]): Color of the Player.
        """
        pygame.sprite.Sprite.__init__(self)
        Rectangle.__init__(self, name, pos, width, height, color)

        self.speed = 5
        self.direction = "right"
        self.player = True
        self.coins = 0
        self.pX = self.x
        self.pY = self.y

        # AI
        self.model = None
        self.AIKeys = 0
        self.room = room

        # * Will be automatically set at the createInstance() function.
        self.instanceGroup = None

        self.controls = {
            "movement": {
                str(pygame.K_w): (0, -self.speed, "up"),
                str(pygame.K_a): (-self.speed, 0, "left"),
                str(pygame.K_s): (0, self.speed, "down"),
                str(pygame.K_d): (self.speed, 0, "right"),
                str(pygame.K_w + pygame.K_a): "upleft",
                str(pygame.K_w + pygame.K_d): "upright",
                str(pygame.K_s + pygame.K_a): "downleft",
                str(pygame.K_s + pygame.K_d): "downright",
            },
            # TODO: Jump function
            "functions": {}
        }

        self.collisionEvents = {
            "right": (-self.speed, 0),
            "left": (self.speed, 0),
            "up": (0, self.speed),
            "down": (0, -self.speed),

            # * All speed in this section is multiplied by 0.0707 because
            # * when it moves diagonally, it moves 1.414 times faster
            # * Reference: https://digisoln.com/gamemaker/gml/topdownplayer
            "upright": (-self.speed * 0.707, self.speed * 0.707),
            "upleft": (self.speed * 0.707, self.speed * 0.707),
            "downright": (-self.speed * 0.707, -self.speed * 0.707),
            "downleft": (self.speed * 0.707, -self.speed * 0.707)
        }

        # AI
        self.AIPress = {
            0: pygame.K_w,
            1: pygame.K_a,
            2: pygame.K_s,
            3: pygame.K_d,
            4: pygame.K_w + pygame.K_a,
            5: pygame.K_w + pygame.K_d,
            6: pygame.K_s + pygame.K_a,
            7: pygame.K_s + pygame.K_d
        }
        self.createAI()
        self.clearKeys = list(pygame.key.get_pressed())

        self.totalrewards = 0

        self.oldX = self.x
        self.oldY = self.y
        self.states = 0
        self.epochsEnd = 1
        self.epochs = 0
        self.initialX = self.x
        self.initialY = self.y