So I’m about to integrate Jython into my current project, but I’m confused as to how to use a scripting language efficiently. From how I understand it, I’m supposed to make certain methods in my Java code that I want to expose to my scripts that will call those methods and manipulate fields/graphics/sounds in my engine; for example, spawning npcs, enemies, loading/saving, setting up levels, cutscenes. Is this how it works? If so, how do I go about exposing my engine’s specific methods to my scripts? The only thing I can find online is exposing OBJECTS to Jython, which I don’t believe is what I’m trying to do. Thanks!
I have limited knowledge of Jython, but this is how I remember it.
You import the packages.
you dont need to use new infront of instantiating objects.
then it acts kinda like normal java using the method.
from javax.swing import *
def create:
frame = JFrame("Window Name")
frame.setSize(600, 600)
frame.setVisibile(True)
I am not too sure, exactly how you would fit it in, maybe the use of Singletons so you can always get the current instance of the class. And make a single class that would hold all your methods that you want to allow for your scripts to access.