##Just a bit of math neccessary for rotating the arrow correctly. Renpy did not want to cooperate.
init python:
def numberset():
return{
1 : [-90, -1, 1],
2 : [-85, -1, 0.91],
3 : [-80, -0.98, 0.83],
4 : [-75, -0.97, 0.74],
5 : [-70, -0.94, 0.65],
6 : [-65, -0.91, 0.58],
7 : [-60, -0.86, 0.5],
8 : [-55, -0.82, 0.43],
9 : [-50, -0.77, 0.36],
10: [-45, -0.71, 0.29],
11: [-40, -0.64, 0.23],
12: [-35, -0.57, 0.18],
13: [-30, -0.5, 0.14],
14: [-25, -0.42, 0.09],
15: [-20, -0.35, 0.06],
16: [-15, -0.26, 0.03],
17: [-10, -0.17, 0.02],
18: [-5, -0.09, 0],
19: [0, 0, 0],
20: [5, 0.09, 0],
21: [10, 0.17, 0.02],
22: [15, 0.26, 0.03],
23: [20, 0.35, 0.06],
24: [25, 0.42, 0.09],
25: [30, 0.5, 0.14],
26: [35, 0.57, 0.18],
27: [40, 0.64, 0.23],
28: [45, 0.71, 0.29],
29: [50, 0.77, 0.36],
30: [55, 0.82, 0.43],
31: [60, 0.86, 0.5],
32: [65, 0.91, 0.58],
33: [70, 0.94, 0.65],
34: [75, 0.97, 0.74],
35: [80, 0.98, 0.83],
36: [85, 1, 0.91],
37: [90, 1, 1],
}
##This is what actually spins the image. It works essentially the same as renpy's rotate function, except here I can change the origin location.
##That is neccessary because Renpy will not allow me to change the center of the image (and actually use that as a center).
##We're also going to casually ignore the fact that the number 187 is not based on any kind of math, and is just a random number that seems to place things right.
##I wasn't that good at math in school, so I can't explain that.
class test_displayable(renpy.Displayable):
def __init__(self, child, number):
super(test_displayable, self).__init__()
self.child = renpy.displayable(child)
self.number = number
def render(self, w, h, st, at):
num = numberset()
t = Transform(renpy.displayable(self.child), rotate = num[self.number][0])
r = renpy.render(t, w, h, st, at)
self.width, self.height = r.get_size()
render = renpy.Render(self.width, self.height)
render.blit(r, (num[self.number][1]*187,num[self.number][2]*187))
return render
##Actual screen that has the thing on it, passes the behaviour number to the rotating function.
screen meter():
add "gui/bar/behaviour_backing.png"
vbox:
xalign 0.5 yalign 0.5
add test_displayable("gui/bar/behaviour_arrow.png", behaviour)