Code: Select all
class MouseItem(renpy.Displayable):
def __init__(self, id):
super(MouseItem, self).__init__()
self.child = Image("images/items/"+id+"_i.png")
mp = renpy.get_mouse_pos()
self.pos = mp
def render(self, width, height, st, at):
render = renpy.Render(config.screen_width, config.screen_height)
child_render = renpy.render(self.child, width, height, st, at)
x,y = self.pos
render.blit(child_render, (x-25, y-25))
if showcursorfollow and x>=-800 and y>=-800:
return render
else:
return renpy.Render(0,0)
def event(self, ev, x, y, st):
# Re-render if the position changed.
if self.pos != (x, y):
renpy.redraw(self, 0)
# Update stored position
self.pos = (x, y)
Code: Select all
init python:
def execute_gametick():
for p in party:
p.tick()
class Blah(object): # party is composed of these
#...
def tick(self):
## tick temp effects
for i in self.tempeffects:
if i.ticking:
i.time -= 1
i.ticktime -= 1
if i.time == 0:
i.remove = True
if i.ticktime == 0:
apply_stats(self, i.stats)
i.ticktime = i.ticklength
# if i.tickmessage:
# showmessage(i.tickmessage)
for i in self.tempeffects:
if i.remove:
self.tempeffects.remove(i)
screen waitforevent():
timer ticklength repeat True action Function(execute_gametick)
What I understand from this is that the action Function() respectively the called function make the UDD flicker.