I am making a game and I would like to have my code split into two files. One, an ordinary javascript file for the gameplay, the other a paperscript file for all the graphics. I want to call functions from the paperscript file from the main file, but as far as I can see it needs to be loaded with type="module"
for me to be able to call functions, but it also needs to be loaded with type="text/paperscript"
for it to work as paperscript.
If there is annother way to call functions from a different file I would like to hear about it, or if there is a way to include both type="module"
and type="text/paperscript"
in the same script element.
If this is not possible I know I could use javascript not paperscript but I would rather not because all the examples I have seen are using paperscript
I've figured out how to do what I want and I feel very stupid now. I learned python and am new to javascript and didn't realise that you could just call functions from other files, in python you can only do this by using modules.
Here I can declare a variable as window.<myVariableName>
in paperscript to be able to access it from raw javascript.