def __init__(self, stage, section): self.stage = stage #The rockmeter self.engine = stage.engine #Game Engine self.config = stage.config #the rockmeter.ini self.section = section #the section of the rockmeter.ini involving this layer self.xposexpr = self.getexpr("xpos", "0.0") self.yposexpr = self.getexpr("ypos", "0.0") self.position = [0.0, 0.0] #where on the screen to draw the layer self.angleexpr = self.getexpr("angle", "0.0") self.angle = 0.0 #angle to rotate the layer (in degrees) self.xscaleexpr = self.getexpr("xscale", "1.0") self.yscaleexpr = self.getexpr("yscale", "1.0") self.scale = [1.0, 1.0] #how much to scale it by (width, height from 0.0 - 1.0) self.color = list(self.engine.theme.hexToColor(self.get("color", str, "#FFFFFF"))) #color of the image (#FFFFFF is white on text, on images it is full color) self.condition = True #when should the image be shown (by default it will always be shown) self.alignment = halign(self.get("alignment", str, "center")) #alignment of the image (horizontal) self.valignment = valign(self.get("valignment", str, "middle")) #alignment of the image (vertical) self.inPixels = self.get("inPixels", str, "").split("|") #makes sure to properly scale/position the images in pixels instead of percent self.effects = [] #various effects associated with the layer
def updateLayer(self, playerNum): self.position = [float(eval(self.xposexpr)), float(eval(self.yposexpr))] self.angle = float(eval(self.angleexpr)) self.scale = [float(eval(self.xscaleexpr)), float(eval(self.yscaleexpr))] self.color = [float(eval(self.r)), float(eval(self.g)), float(eval(self.b)), float(eval(self.a))] self.alignment = halign(self.alignExpr) self.valignment = valign(self.valignExpr) #makes sure color has an alpha value to consider if len(self.color) == 3: self.color.append(1.0)
def updateLayer(self, playerNum): self.position = [ float(eval(self.xposexpr)), float(eval(self.yposexpr)) ] self.angle = float(eval(self.angleexpr)) self.scale = [ float(eval(self.xscaleexpr)), float(eval(self.yscaleexpr)) ] self.color = [ float(eval(self.r)), float(eval(self.g)), float(eval(self.b)), float(eval(self.a)) ] self.alignment = halign(self.alignExpr) self.valignment = valign(self.valignExpr) #makes sure color has an alpha value to consider if len(self.color) == 3: self.color.append(1.0)