I appreciate your posts a lot, they're really helpful since it's not that easy to find content on kaplay. I'm really new to dev stuff, so I was amazed when I came across kaplay, because it's much more intuitive than the other gamedev tools I've found before.
One thing about using the lib this "crudely" I noticed is that I wasn't able to get the auto completion for the kaplay methods and objects as well as the documentation pop-ups on VS Code. As I mentioned before, I'm really new to this stuff, so I'm not sure if that's expected or if it could be fixed through setting some things up.
You can get intellisense in VSCode for KAPLAY even when importing it with a script tag like shown in this post. To achieve this, you need to download the doc.d.ts file. For example, https://unpkg.com/kaplay@4000.0.0-alpha.15/dist/doc.d.ts.
You need to then place that file at the root of your project folder and rename it to "global.d.ts". Once you do this, you'll get intellisense for KAPLAY when using functions, etc...
Oh, thank you! I wasn't really able to make that works though. I'm supposed to download the .d.ts file the same way it was done to the kaplay.mjs, right? So I have 4 basic files in my project folder: index.html, main.js, kaplay.mjs and global.d.ts. Besides placing the last file in the same directory is any other config needed?
As you write loadSprite you should see a doc snippet appear. (Assuming you're doing this in VSCode since this setup only works in that code editor)
One other thing you could try is to make sure to open the .d.ts file at least once in the editor before writing your KAPLAY code. I'm not sure if that does anything but maybe that will resolve your issue.
Unfortunately, it did not work. I've tried changing the versions, for both the kaplay.mjs and the doc.d.ts files accordingly (renaming the last one to global.d.ts as you instructed), and still couldn't get the intellisense. Guess I'll have to stick to the Vite dev environment for now since it works just fine, though the extra files and folders get me a little dizzy, but nothing that cannot be hadled of course. Thank you, again!
I tried my setup again and noticed that the intellisense would only appear after the function has been written. For example, only when fully writing k.loadSprite() would I get the doc snippet to appear explaining what the function does.
So in the end the intellisense isn't as great compared to using a bundler. I guess everything has a tradeoff :/
I appreciate your posts a lot, they're really helpful since it's not that easy to find content on kaplay. I'm really new to dev stuff, so I was amazed when I came across kaplay, because it's much more intuitive than the other gamedev tools I've found before.
One thing about using the lib this "crudely" I noticed is that I wasn't able to get the auto completion for the kaplay methods and objects as well as the documentation pop-ups on VS Code. As I mentioned before, I'm really new to this stuff, so I'm not sure if that's expected or if it could be fixed through setting some things up.
You can get intellisense in VSCode for KAPLAY even when importing it with a script tag like shown in this post. To achieve this, you need to download the doc.d.ts file. For example, https://unpkg.com/kaplay@4000.0.0-alpha.15/dist/doc.d.ts.
You need to then place that file at the root of your project folder and rename it to "global.d.ts". Once you do this, you'll get intellisense for KAPLAY when using functions, etc...
I just discovered this btw.
Oh, thank you! I wasn't really able to make that works though. I'm supposed to download the .d.ts file the same way it was done to the kaplay.mjs, right? So I have 4 basic files in my project folder: index.html, main.js, kaplay.mjs and global.d.ts. Besides placing the last file in the same directory is any other config needed?
Try doing the following :
import kaplay from "./kaplay.mjs";
const k = kaplay();
k.loadSprite()
As you write loadSprite you should see a doc snippet appear. (Assuming you're doing this in VSCode since this setup only works in that code editor)
One other thing you could try is to make sure to open the .d.ts file at least once in the editor before writing your KAPLAY code. I'm not sure if that does anything but maybe that will resolve your issue.
Can you tell me if this end up working?
Unfortunately, it did not work. I've tried changing the versions, for both the kaplay.mjs and the doc.d.ts files accordingly (renaming the last one to global.d.ts as you instructed), and still couldn't get the intellisense. Guess I'll have to stick to the Vite dev environment for now since it works just fine, though the extra files and folders get me a little dizzy, but nothing that cannot be hadled of course. Thank you, again!
I tried my setup again and noticed that the intellisense would only appear after the function has been written. For example, only when fully writing k.loadSprite() would I get the doc snippet to appear explaining what the function does.
So in the end the intellisense isn't as great compared to using a bundler. I guess everything has a tradeoff :/