Skip to content

Instantly share code, notes, and snippets.

@yonderbread
Forked from amsam0/ctjs-faq.md
Last active September 8, 2020 18:35
Show Gist options
  • Save yonderbread/e48afe932345cdf98bc747363e8edada to your computer and use it in GitHub Desktop.
Save yonderbread/e48afe932345cdf98bc747363e8edada to your computer and use it in GitHub Desktop.
ct.js FAQ

ct.js FAQ

The camera won't follow my charater!

Make sure you have this code in your character's 'On Create' tab:

ct.camera.follow = this;

// Optional; sets the frame inside which the copy will be kept, in game pixels. Can be set to `null` so the copy is set to the center of the screen.
ct.camera.borderX = 450;
ct.camera.borderY = 200;

How can I read the string typed with a keyboard?

You'll need the keyboard catmod. (Go to Project tab > Catmods > Search for Keyboard. It will have a red ❌ if it's disabled. Press it to enable.)

To get keyboard input, use the variable ct.keyboard.string. Keep in mind this will reset when the Enter key is pressed.

Why is my game blurry?/Pixel art is smoothed

If your game has pixel art, you will need to enable this option.

Go to the Project tab > Render Options and enable Disable image smoothing here and in exported project (preserve crisp pixels). This should fix the problem.

I'm trying to music in my game menu, but no sound plays!

This is because PIXI.js is unable to play sounds unless the program has been interacted with, try adding something the player can interact with first before entering the menu, such as clicking any key to start.

Troubleshooting Links


If you can't find an answer to your question here, try asking in <#490054175141527552>. You may want to work on another part of your ct.js project while waiting for an answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment