The first code block is the actual relevant block of code, the second code block is where I defined the Node class and list of nodes
Code: Select all
screen flowchart():
default select_node = None
frame:
xysize (config.screen_width, config.screen_height)
# this bg is just a blue-green screen
add "bg_flowchart"
vbox:
align (0.5, 0.5)
viewport id "repaired_flowchart":
xalign 0.5
yalign 0.5
# xysize (3865, 2185)
xysize(900, 2000)
xinitial 0.5
# this code works, since it adds the images in the right spot
for node in nodes:
add node.get_icon() pos (node.coordinates) size (40, 40)
imagemap:
# I only need the ground image, just added the others in case there's a bug
ground "flowchart/images/flowchart_repaired_no_true.png"
idle "flowchart/images/flowchart_repaired_no_true.png"
hover "flowchart/images/flowchart_repaired_no_true.png"
for node in nodes:
# this code doesn't work, since a sound isn't playing
hotspot (node.coordinates[0], node.coordinates[1], 40, 40):
# sound playing is just to try and verify it's working
hover_sound "sound/confirm-beep.mp3"
# commented out cause not working anyway
# action [Function(update_transform, node), SetVariable("select_node", node)]
Code: Select all
init python:
from enum import Enum
class Status(Enum):
UNREAD = "unread"
NOVEL = "novel"
ESCAPE = "escape"
END = "end"
class Node:
def __init__(self, coordinates, name, description, is_accessible, status=None, icon=None):
self.coordinates = coordinates
self.name = name
self.description = description
self.is_accessible = is_accessible
self.status = status
self.icon = icon
def set_is_accessible(self, is_accessible):
self.is_accessible = is_accessible
def get_icon(self):
if self.icon:
return self.icon
if self.status is Status.UNREAD:
return 'flowchart/images/nodes/unread.png'
elif self.status is Status.NOVEL:
return 'flowchart/images/nodes/novel.png'
elif self.status is Status.ESCAPE:
return 'flowchart/images/nodes/escape.png'
return None
nodes = [
Node((400, 0), "Fragment 0 ~ Scene 1", "Beginning", True, Status.NOVEL),
Node((400, 80), "Fragment 0 ~ Scene 2", "Meeting Everyone", frag0_s1_complete, Status.UNREAD),
Node((400, 160), "Fragment 0 ~ Scene 3", "Rules of the Game", frag0_s2_complete, Status.UNREAD),
Node((400, 240), "End of Prologue", None, frag0_complete, Status.END, "flowchart/images/nodes/badend.png")
]
2. The hotspot doesn't work at all, even if I change it to a single massive hotspot
3. I don't care about giving the images a hover or idle effect, because my goal is just to make the flowchart interactable
4. Failing any help here, I would love some advice on how I can debug with Ren'Py. I have no visibility with logs, print statements, etc
I've looked at documentation, which isn't super helpful because it never actually documents all the attributes. I've also looked at some of the imagemap posts on this forum.
Attached are my ground image, and the rendered image I have so far with the nodes I've made so far. I'm hoping at the end to use some sort of crosshair to indicate the selected node and allow the user to select other nodes with the arrow keys.