Using a color map loaded to a surface to mark up areas on the game screen.
EDIT 2020-04-24:
It has been brought to my attention that there is a problem with using this code when attempting to make a save.
I have made the following changes in the original code to correct that problem. The main part is to move the im.load_surface part to a function. This way there is no loaded surface for save to handle
Code: Select all
init python:
def colorpick(pix,x,y):
if pix==1:
floor=im.load_surface("images/colormap.png")
inout=floor.get_at((x,y)) [:3]
return inout
In the code below the following chances are needed.
remove
$ floor=im.load_surface("images/colormap.png")
and replace
$ inout=floor.get_at((mX,mY)) [:3]
with
$ inout=colorpick(1,mX,mY)
and you should be good to go.
original code
Code: Select all
screen checker():
text str(mX) + ":" + str(mY)
text str(inout) ypos 20
text teller pos (mX, mY-20) color "#F00"
label start:
label room:
scene room
show screen checker
$ floor=im.load_surface("images/colormap.png")
label rotator:
$ mX, mY = renpy.get_mouse_pos()
$ inout=floor.get_at((mX,mY)) [:3]
if inout==(255,255,255):
$ teller="Nothing worth noting."
elif inout==(255,0,0):
$ teller="Door"
elif inout==(255,0,128):
$ teller="Lamp"
elif inout==(255,32,0):
$ teller="Anzi the Owl"
elif inout==(255,64,0):
$ teller="Semi's head"
elif inout==(255,96,0):
$ teller="Semi"
elif inout==(255,128,0):
$ teller="Stool"
elif inout==(0, 255,64):
$ teller="Table"
elif inout==(0, 0, 255):
$ teller="Game of Ur"
elif inout==(255,0,0):
$ teller="Bob"
elif inout==(0,255,0):
$ teller="Bob's hat"
elif inout==(96, 255,0):
$ teller="Bob's face"
elif inout==(128, 255,0):
$ teller="Bob's beard"
elif inout==(0,255,128):
$ teller="Bob"
elif inout==(64,255,0):
$ teller="Bob's hand"
elif inout==(32,255,0):
$ teller="Bob's sword"
elif inout==(0,255,96):
$ teller="Pillow"
elif inout==(255,0,96):
$ teller="Exit"
elif inout==(64,0,255):
$ teller="Sign"
elif inout==(128,0,255):
$ teller="X"
elif inout==(96,0,255):
$ teller="flower"
$ renpy.pause(0.1, hard="True")
jump rotator