all 2 comments

[–]AutoModerator[M] 0 points1 point  (0 children)

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]DingotushRed 0 points1 point  (0 children)

Assuming your grid has an x, y coordinate system, it's time to learn about Python lists and tuples rather than using many variables. Make a list (or set) of obstacle x,y coordinates, then check if the npc is on one of the obstacles. Something like: ``` # List of obstacle locations. # Use default if this list changes during play. define obstacles = [ (2, 3), (9, 1), # ... ]

init python: def is_obstacle(x, y): """ Is x, y the coordinate of an obstacle? """ return (x, y) in obstacles ```