Willard21 / MineKhan

Minecraft for Khan Academy
78 stars 52 forks source link

[Question] KA Version Refactoring #90

Closed MicrolemurDev closed 1 year ago

MicrolemurDev commented 2 years ago

I know the KA Version isn't up to date but I have been playing with the source code and found that trying to split up the JavaScript causes huge console spam relating to the render context. I am curious how the source for this version was able to be split up without causing huge console error spam.

TLDR: I am getting huge amounts of errors when trying to move the KA Version to multiple files. Why is this?

Willard21 commented 2 years ago

I assume you're running some initialization code more than you're supposed to or something. I can't answer questions about code I've never seen. Splitting code into multiple files on this project is a little complex because there's so many functions editing shared variables that aren't global. They're all in a big closure. Phi started splitting it up, and he mostly made it work by adding the shared variables to function parameters.

MicrolemurDev commented 2 years ago

Now I got past some first issues but still am now dealing with drawScreens[screen] not being a function? Do you know where this is defined by any chance?

Refactoring code is annoying but has to be done.

Willard21 commented 1 year ago

This isn't an issue with this version so I'm closing it.