Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I'm an artist. Maths and coding is not my thing. I've never really understood the structure of coding and not for lack of trying. The threshold always too high for me to pass. And when trying my very best, my "coding" is like that of a dyslectic, constantly "spelling" the code incorrectly. But today, i found out about Coffeescript https://coffeescript.org And i feel like, wow, I can understand this! So, this could work for use with Coppercube, right? (compiled into Javascript). Or will it translate some of it into a "new" javascript-version that Coppercube won't digest? As one example i found: When writing == in Coffeescript, it seems to be translated into === when compiled to Javascript - an example that will not work, or? |
||||
|
Hi blackwater, Answer is both yes and no:) You can fully use it if you target webgl, but using it for desktop is questionable. Modern coffeescript translates to es6 javascript, which is not supported by CopperCube. Coppercube only supports es1 or es3 version. If you avoid using modern features in your script you probably can code with it. At some point your code might be translated to js which utilizes es5+ features, and it will stop working. The issue is that you don't have any control over this translation process. So if compiler decides to use es5+ syntax it will do that, and you can't do anything about that. You can also try old coffeescript version which I believe translates to es5, which is much closer to the version we have in coppercube. Or try using babel to translate es6 code to es5. I don't really think the last one will work. Overall, usecase is the following. 1. Install coffeescript globably, as the site you provided says. 2. Create new coppercube file 3. Create another file named the same, as just created .ccb file but set its extension to ".coffee". so if coppercube file is demo.ccb, new file name should be "demo.coffee" 4. Add your script demo.coffee file, like someVariable = 'hello from coffeescript' 5. Compile to js using command line: coffee -c demo.coffee. This will create another file with .js extension like: // Generated by CoffeeScript 2.7.0 6. Build and run coppercube game from the editor 7. You should see "hello from coffeescript" message printed out. Demo:https://drive.google.com/file/d/... |
||||
|
Thanks for claryfing! |
|