Detecting images on contact
Posted: Sat Oct 29, 2022 7:27 pm
Is there a way to check if an image touches other image and if possiple make it a function?
Supporting creators of visual novels and story-based games since 2003.
https://lemmasoft.renai.us/forums/
Code: Select all
init python:
def get_opaque(img, x=None, y=None):
rv = renpy.render(renpy.displayable(img), config.screen_width, config.screen_height, 0, 0)
w, h = rv.get_size()
w, h = int(w), int(h)
if x is None:
x = w - 1
if y is None:
y = h - 1
return rv.is_pixel_opaque(x, y)
def is_opaque(img, x=None, y=None, min_a=0):
a = is_opaque(img, x, y)
return a > min_a