forked from fofix/fofix
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MLv4 Face-off rockmeter (experimental)
- Loading branch information
Showing
2 changed files
with
119 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,52 @@ | ||
|
||
from Rockmeter import * | ||
|
||
class Spinner(ImageLayer): | ||
def __init__(self, stage, section): | ||
class CoOpMeter(Group): | ||
def __init__(self, stage, section): | ||
|
||
self.stage = stage | ||
super(Spinner, self).__init__(stage, section, os.path.join("themes", self.stage.themename, "rockmeter", "platinum.png")) | ||
|
||
self.xposexpr = ".80" | ||
self.yposexpr = ".80" | ||
|
||
self.condition = "True" | ||
|
||
def updateLayer(self, playerNum): | ||
super(ImageLayer, self).updateLayer(playerNum) | ||
|
||
self.angle += 2 | ||
|
||
def render(self, visibility, playerNum): | ||
super(CoOpMeter, self).__init__(stage, section) | ||
|
||
self.ySpacingExpr = self.getexpr("yspacing", "0.0") | ||
self.ySpacing = 0.0 | ||
self.condition = "True" | ||
|
||
self.updateLayer(playerNum) | ||
print self.layers.values() | ||
|
||
def updateLayer(self, playerNum): | ||
super(CoOpMeter, self).updateLayer(playerNum) | ||
|
||
self.ySpacing = eval(self.ySpacingExpr) | ||
|
||
def render(self, visibility, playerNum): | ||
w, h, = self.engine.view.geometry[2:4] | ||
|
||
self.updateLayer(playerNum) | ||
for effect in self.effects: | ||
effect.update() | ||
|
||
self.engine.view.setViewportHalf(1,0) | ||
i = playerNum | ||
scale = (.75*(len(self.stage.scene.playerList)/2)) | ||
|
||
for layer in self.layers.values(): | ||
layer.updateLayer(playerNum) | ||
for effect in layer.effects: | ||
effect.update() | ||
layer.position = [p*scale for p in layer.position] | ||
layer.scale = [s*scale for s in layer.scale] | ||
if isinstance(layer, FontLayer): | ||
layer.position = [layer.position[0] + (self.position[0]/w), layer.position[1] - (self.position[1]/h)*.75] | ||
layer.position[1] -= (self.ySpacing*scale/h)*.75*(i/2) | ||
else: | ||
layer.position = [layer.position[n] + self.position[n] for n in range(2)] | ||
layer.position[1] -= (self.ySpacing*scale/h)*(i/2) | ||
|
||
coord = self.position | ||
scale = self.scale | ||
rot = self.angle | ||
color = self.color | ||
alignment = self.alignment | ||
valignment = self.valignment | ||
drawing = self.drawing | ||
rect = self.rect | ||
#flips across screen for every other player | ||
if i % 2 == 1: | ||
layer.position[0] = w - layer.position[0] | ||
layer.scale[0] *= -1 | ||
layer.angle *= -1 | ||
|
||
#frameX = self.frameX | ||
#frameY = self.frameY | ||
|
||
if bool(eval(self.condition)): | ||
self.engine.drawImage(drawing, scale, coord, rot, color, rect, | ||
alignment = alignment, valignment = valignment) | ||
#layer.scale = [s/(2.0*(len(self.stage.scene.playerList)/2)) for s in layer.scale] | ||
layer.render(visibility, playerNum) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#bars | ||
[layer0:Image] | ||
texture = bar.png | ||
yscale = 270 | ||
xscale = 100 | ||
inPixels = xscale|yscale | ||
valignment = bottom | ||
alignment = left | ||
angle = 90 | ||
rect = (1.0/3.0, 2.0/3.0, 1.0-rock, 1.0) | ||
|
||
[layer1:Image] | ||
texture = bar.png | ||
yscale = 270 | ||
xscale = 100 | ||
inPixels = xscale|yscale | ||
valignment = bottom | ||
alignment = left | ||
angle = 90 | ||
rect = (0.0, 1.0/3.0, 0.0, 1.0) | ||
|
||
[layer2:Image] | ||
texture = bar.png | ||
ypos = -25 | ||
yscale = 220 | ||
xscale = 100 | ||
inPixels = xscale|yscale|ypos | ||
valignment = bottom | ||
alignment = left | ||
angle = 90 | ||
rect = (2.0/3.0, 1.0, 1.0-power, 1.0) | ||
|
||
[layer3:Image] | ||
texture = bar.png | ||
ypos = -25 | ||
yscale = 220 | ||
xscale = 100 | ||
inPixels = xscale|yscale|ypos | ||
valignment = bottom | ||
alignment = left | ||
angle = 90 | ||
rect = (0.0, 1.0/3.0, 0.0, 1.0) | ||
|
||
[layer4:Text] | ||
text = playerName | ||
ypos = 20 | ||
xpos = .01 | ||
outline = True | ||
font = scoreFont | ||
color = #999999 | ||
alignment = left | ||
inPixels = ypos | ||
|
||
[layer5:Image] | ||
texture = hud.png | ||
alignment = left | ||
ypos = 20 | ||
inPixels = ypos | ||
|
||
[layer6:Text] | ||
text = playerName | ||
ypos = 20 | ||
xpos = .01 | ||
outline = True | ||
font = scoreFont | ||
alignment = left | ||
inPixels = ypos | ||
|
||
[layer7:Custom] | ||
classname = CoOpMeter | ||
layers = 0,1,2,3,4,5,6 | ||
ySpacing = 25 | ||
ypos = .8 | ||
|