Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs

ct.js

Create cool 2D games with a free game editor! · By Cosmo Myzrail Gorynych

Add .txt file to the project

A topic by MikeMatthews created 34 days ago Views: 33 Replies: 3
Viewing posts 1 to 3

Did somebody find a way to add a .txt file to the project and read data from it?
I plan on doing some dialogue so it's absolutely necessary.

Developer

Create an "include" folder inside your project's one so they get copied to the exported project, and use the available js APIs or libraries for reading from it. I recommend the standard fetch API (e.g. see this particular StackOverflow answer).

Reading and writing files is out of ct.js' scope, because this functionality exists in any js environment, in one way or another.

(+1)

Perfect !

Maybe this should be added to documentation for beginners. It's my first time using JavaScript so I don't know how basic this is.

Developer(+1)

That's a good thought! I added an issue and will come to this task soon.

Just in case, docs are open for contributions on GitHub. If you have time, you can add helpful tips or tutorials by yourself — it's not that hard, from the technical point of view.