class Dummy(object): name = "dummy" priorities = (9999,100000) def initilize(self): w = Graphics.SCREEN_WIDTH - 10 h = Graphics.SCREEN_HEIGHT - 10 # x y w h r g b self.rect1 = Rect((0, 0), 10, 10, (255, 0, 0)) # top-left : red self.rect2 = Rect((0, h), 10, 10, ( 0, 255, 0)) # bottom-left : green self.rect3 = Rect((w, 0), 10, 10, ( 0, 0, 255)) # top-right : blue self.rect4 = Rect((w, h), 10, 10, (255, 255, 255)) # bottom-right : white Entity.string_add("DynamicBox, 15, 26, 1, 1, bluecreep.png") # self.add(read_Entity("DynamicBox, 1, 32, 1, 1, bluecreep.png")) # self.add(read_Entity("StaticBox, 16, 0, 32, 10, 255, 100, 0")) pass def update(self,time_passed): self.rect1.render() self.rect2.render() self.rect3.render() self.rect4.render() pass
def initilize(self): w = Graphics.SCREEN_WIDTH - 10 h = Graphics.SCREEN_HEIGHT - 10 # x y w h r g b self.rect1 = Rect((0, 0), 10, 10, (255, 0, 0)) # top-left : red self.rect2 = Rect((0, h), 10, 10, ( 0, 255, 0)) # bottom-left : green self.rect3 = Rect((w, 0), 10, 10, ( 0, 0, 255)) # top-right : blue self.rect4 = Rect((w, h), 10, 10, (255, 255, 255)) # bottom-right : white Entity.string_add("DynamicBox, 15, 26, 1, 1, bluecreep.png") # self.add(read_Entity("DynamicBox, 1, 32, 1, 1, bluecreep.png")) # self.add(read_Entity("StaticBox, 16, 0, 32, 10, 255, 100, 0")) pass
def viewport(self) -> Rect: widget = self.builder.get_object('drawing_area') return Rect(min=Vec2(0, 0), max=Vec2( widget.get_allocated_width(), widget.get_allocated_height(), )).with_margin(10)
def initilize(self, locx, locy, width, height, red, green, blue): self.physics = physics.StaticBox() self.physics.initilize(locx, locy, width, height) # convert_to_screen([locx,locy]), # width, height, rect = pbox_to_gbox(locx, locy, width, height) self.renderable = Rect( rect[:2], rect[2], rect[3], (red, green, blue))
class StaticBox(object): """A box with a bitmap does not move! Has no AI at all. # type, locx, locy, width, height, red, green, blue StaticBox, 16, -5, 32, 10, 255, 100, 0 """ def initilize(self, locx, locy, width, height, red, green, blue): self.physics = physics.StaticBox() self.physics.initilize(locx, locy, width, height) # convert_to_screen([locx,locy]), # width, height, rect = pbox_to_gbox(locx, locy, width, height) self.renderable = Rect( rect[:2], rect[2], rect[3], (red, green, blue)) def update(self, time_passed): self.renderable.render() pass