def handleleftclick(self, mousepos): # TODO: handle dragging vs clicking more reliably if self.clickat is None: # It's a drag return (x0, y0), (x1, y1) = self.clickat, mousepos if abs(x0-x1) + abs(y0-y1) > 25: return vicon = vista.iconhit(mousepos) # Any vista icons pointed to if vicon is not None: self.handleiconclick(vicon) return bicon = panels.iconpoint(mousepos) # Any panel tile or icon pointed to if bicon is not None: panels.selecticon(bicon) return # Click on the main gameplay area if vista.vrect.collidepoint(mousepos): if self.cutmode and self.target is not None: self.target.die() self.clearselections() elif self.healmode and self.target is not None: self.target.autoheal = not self.target.autoheal elif self.parttobuild is not None and self.canbuild and game.state.body.canaddpart(self.parttobuild): if panels.selectedtile is not None: panels.claimtile() if panels.selectedorgan is not None: panels.claimorgan() game.state.body.addpart(self.parttobuild) self.clearselections() else: worldpos = vista.screentoworld(mousepos) if vista.HexGrid.nearesttile(worldpos) == (0,0): settings.showtips = not settings.showtips noise.play("addpart") return # Click on one of the panels self.clearselections()
def choosetip(self, mousepos): bicon = panels.iconpoint(mousepos) # Any build icons pointed to vicon = vista.iconhit(mousepos) # Any vista icons pointed to if vicon == "trash": if panels.selectedtile is not None: return _("want to get rid of the stalk option? click here!") else: return _("want to get rid of a stalk option? click on the stalk, then click here! you can also right-click on the stalk option") elif vicon == "zoomin": return elif vicon == "zoomout": return elif vicon == "menu": return _("click to pause or quit game and pick options. it okay. me wait") elif vicon == "music": return _("click to hear new song or turn songs off") elif vicon == "heal": if self.healmode: return _("green organs will heal themself with ooze. red organs won't. click on organs you want to change") return _("me organs will use ooze to heal when they get hurt. if you want some organs not to take ooze, click here to change them") elif vicon == "cut": return _("you no like a stalk or a organ on me body? use this to get rid of it! it okay, me not get hurt") elif bicon is not None: if bicon in range(mechanics.ntiles): return _("these me stalk options, har har har! can grow stalks where colors match, and can make stalks cross each other. try to make lots of branches.") elif bicon == "ncube": return _("the more me have of that organ, the faster the new stalks come") elif bicon == "control": return _("me need brains to grow. the more brains me have, the more organs me can have") elif bicon == "mutagenmeter": return _("that show how much mutagen me have. me like mutagen. it let me grow") elif bicon == "oozemeter": return _("that show how much ooze me have. hurt organs will use ooze to heal selfs") elif bicon in mechanics.info: return mechanics.info[bicon] return None elif vista.vrect.collidepoint(mousepos): worldpos = vista.screentoworld(mousepos) if vista.HexGrid.nearesttile(worldpos) == (0,0): return _("click me mouth to turn me tips on or off")
def choosetip(self, mousepos): bicon = self.status.iconpoint(mousepos) # Any build icons pointed to vicon = vista.iconhit(mousepos) # Any vista icons pointed to if vicon == "trash": if self.panel.selected is not None: return "click this to get rid of stalk and get new one" else: return "if you no like a stalk, click on stalk then click here to get new one. or you can right-click on stalk, it faster" elif vicon == "zoomin": return elif vicon == "zoomout": return elif vicon == "pause": return "click to pause game. it okay. me wait" elif vicon == "music": return "click to hear new song or turn off" elif vicon == "heal": if self.healmode: return "click on organs to change them so they don't heal by self. no want to waste ooze on non-vital organs" return "me organs will use ooze to heal when they get hurt. if you want some organs not to take ooze, click here to change them" elif vicon == "cut": return "no like a stalk or a organ on me body? use this to get rid of it! it okay, me not get hurt" elif vista.prect.collidepoint(mousepos): jtile = self.panel.iconp(mousepos) if jtile in (0, 1, 2, 3, 4, 5): return "these me stalk options, har har har! can grow stalks where colors match. try make lots of branches." else: return self.panel.choosetip(mousepos) elif bicon is not None: return mechanics.info[bicon.name] elif vista.vrect.collidepoint(mousepos): worldpos = vista.screentoworld(mousepos) if vista.HexGrid.nearesttile(worldpos) == (0,0): return "click me mouth to turn me tips on or off" organ = self.body.nearestorgan(worldpos) elif vista.rrect.collidepoint(mousepos): return self.status.choosetip(mousepos)
def choosetip(self, mousepos): bicon = self.status.iconpoint(mousepos) # Any build icons pointed to vicon = vista.iconhit(mousepos) # Any vista icons pointed to if vicon == "trash": if self.panel.selected is not None: return "click this to get rid of stalk and get new one" else: return "if you no like a stalk, click on stalk then click here to get new one. or you can right-click on stalk, it faster" elif vicon == "zoomin": return elif vicon == "zoomout": return elif vicon == "pause": return "click to pause game. it okay. me wait" elif vicon == "music": return "click to hear new song or turn off" elif vicon == "heal": if self.healmode: return "click on organs to change them so they don't heal by self. no want to waste ooze on non-vital organs" return "me organs will use ooze to heal when they get hurt. if you want some organs not to take ooze, click here to change them" elif vicon == "cut": return "no like a stalk or a organ on me body? use this to get rid of it! it okay, me not get hurt" elif vista.prect.collidepoint(mousepos): jtile = self.panel.iconp(mousepos) if jtile in (0, 1, 2, 3, 4, 5): return "these me stalk options, har har har! can grow stalks where colors match. try make lots of branches." else: return self.panel.choosetip(mousepos) elif bicon is not None: return mechanics.info[bicon.name] elif vista.vrect.collidepoint(mousepos): worldpos = vista.screentoworld(mousepos) if vista.HexGrid.nearesttile(worldpos) == (0, 0): return "click me mouth to turn me tips on or off" organ = self.body.nearestorgan(worldpos) elif vista.rrect.collidepoint(mousepos): return self.status.choosetip(mousepos)
def handleleftclick(self, mousepos): if self.clickat is None: # It's a drag return (x0, y0), (x1, y1) = self.clickat, mousepos if abs(x0-x1) + abs(y0-y1) > 25: return bicon = self.status.iconpoint(mousepos) # Any build icons pointed to vicon = vista.iconhit(mousepos) # Any vista icons pointed to if vicon == "trash": if self.panel.selected is not None: self.panel.claimtile() noise.play("trash") self.clearselections() elif vicon == "zoomin": vista.zoomin() elif vicon == "zoomout": vista.zoomout() elif vicon == "pause": self.pause() elif vicon == "music": noise.nexttrack() elif vicon == "heal": self.body.core.setbranchstatus() if self.healmode: self.clearselections() else: self.clearselections() if vista.icons["heal"].active: self.healmode = True elif vicon == "cut": if self.cutmode: self.clearselections() else: self.clearselections() if vista.icons["cut"].active: self.cutmode = True elif vista.prect.collidepoint(mousepos): # Click on panel self.clearselections(clearpanel = False) jtile = self.panel.iconp(mousepos) if jtile in (None, 0, 1, 2, 3, 4, 5): self.panel.selecttile(jtile) elif bicon is not None: self.clearselections(clearstatus = False) self.status.select(bicon.name) elif vista.vrect.collidepoint(mousepos): if self.cutmode and self.target is not None: self.target.die() self.clearselections() elif self.healmode and self.target is not None: self.target.autoheal = not self.target.autoheal elif self.parttobuild is not None and self.canbuild and self.body.canaddpart(self.parttobuild): if self.panel.selected is not None: self.panel.claimtile() if self.status.selected is not None: self.status.build() self.body.addpart(self.parttobuild) self.clearselections() else: worldpos = vista.screentoworld(mousepos) if vista.HexGrid.nearesttile(worldpos) == (0,0): settings.showtips = not settings.showtips noise.play("addpart")
def handleleftclick(self, mousepos): if self.clickat is None: # It's a drag return (x0, y0), (x1, y1) = self.clickat, mousepos if abs(x0 - x1) + abs(y0 - y1) > 25: return bicon = self.status.iconpoint(mousepos) # Any build icons pointed to vicon = vista.iconhit(mousepos) # Any vista icons pointed to if vicon == "trash": if self.panel.selected is not None: self.panel.claimtile() noise.play("trash") self.clearselections() elif vicon == "zoomin": vista.zoomin() elif vicon == "zoomout": vista.zoomout() elif vicon == "pause": self.pause() elif vicon == "music": noise.nexttrack() elif vicon == "heal": self.body.core.setbranchstatus() if self.healmode: self.clearselections() else: self.clearselections() if vista.icons["heal"].active: self.healmode = True elif vicon == "cut": if self.cutmode: self.clearselections() else: self.clearselections() if vista.icons["cut"].active: self.cutmode = True elif vista.prect.collidepoint(mousepos): # Click on panel self.clearselections(clearpanel=False) jtile = self.panel.iconp(mousepos) if jtile in (None, 0, 1, 2, 3, 4, 5): self.panel.selecttile(jtile) elif bicon is not None: self.clearselections(clearstatus=False) self.status.select(bicon.name) elif vista.vrect.collidepoint(mousepos): if self.cutmode and self.target is not None: self.target.die() self.clearselections() elif self.healmode and self.target is not None: self.target.autoheal = not self.target.autoheal elif self.parttobuild is not None and self.canbuild and self.body.canaddpart( self.parttobuild): if self.panel.selected is not None: self.panel.claimtile() if self.status.selected is not None: self.status.build() self.body.addpart(self.parttobuild) self.clearselections() else: worldpos = vista.screentoworld(mousepos) if vista.HexGrid.nearesttile(worldpos) == (0, 0): settings.showtips = not settings.showtips noise.play("addpart")