This question is not about the UDD functionality, but simply why on earth only one of my two variables (bucket, xy_pos) are getting updated in the event function.
Run the code - move/click the mouse - Then use the inspector to inspect the variables
bucket has tons of data in it.
But xy_pos remains unchanged (at 0.0) - Which, to me, is baffling.
Both are declared and used in the same places.
Only difference is that one is a list, and the other a tuple.
I'm new to both Renpy and Python - So I'm guessing (hoping) it's simply some quirk in either I'm unaware of.
Any suggestions as to what is going on?
Code: Select all
init python:
bucket = []
xy_pos = (0,0)
class Udd_tester(renpy.Displayable):
def __init__(self, **kwargs):
super(Udd_tester, self).__init__(**kwargs)
self.tile_size = 5
self.board = [[0,0],[0,0]]
self.tiles = [
Solid("FFF", xysize=(self.tile_size, self.tile_size)),
Solid("F00", xysize=(self.tile_size, self.tile_size))
]
self.width = len(self.board) * self.tile_size
self.height = self.width
def render(self, width, height, st, at):
render = renpy.Render(self.width, self.height)
for y, row in enumerate(self.board):
for x, val in enumerate(row):
render.place(self.tiles[self.board[y][x]] , x * self.tile_size, y * self.tile_size)
return render
def event(self, ev, x, y, st):
global xy_pos
bucket.append((x,y))
xy_pos = (x,y)
if renpy.map_event(ev, 'mousedown_1'):
self.board[0][0] = 1
renpy.redraw(self, 0)
# def visit(self):
# return [self.child]
screen udd_screen():
add Udd_tester():
xalign 0.5
yalign 0.5
label udd_test:
call screen udd_screen
"Testing"
return