Quick documentation all the functions and how to use them. I think every one is used in sample_room.html.
Note: this document is not up to date anymore. I have not been updating it.
The new clicker adding method. create a clicker at x, y, with size width, height.
It has an id (used for coding and logic), a background picture (optional!), and a function that executes on click.
Removes the clicker that has the specified id. cannot be used to remove non-clicker elements (a bit of a no-brainer, but worth remembering)
Returns true if there's an item with the name name in the inventory, false if not.
Add an item to the inventory, with a String name and a String img_src. the image should be 50x50 pixels, and formatted like this example: items/key.png. It won't add the item if you already have one with the same name.
Remove the first item with the name name from the inventory.
Remove everything from the inventory.
Sets the subtitle beneath the inventory bar to the String message. Does not persist between rooms like the inventory. Use it for stuff like telling the player if a door is locked.
Sets the background picture to url. Used at the creation of the room, but can be used for other cool stuff, if needed.
Sets the background color, outside of the viewing area.
Sets the border of the viewing area to a color. best used in conjunction with background_set for max cool
These functions set what room the left/right/top/bottom clickable areas send the player to.
Create a Sound object. with the source src.
Play the sound, once.
Play the sound on repeat. NOTE: starts it from a RANDOM point, to make room transitions less repetitive
Stop the sound.
show an inline view with the specified picture as the background.
executes the on_load function every time it loads. use this to create the inline clickers for it with add_inline_clicker()
hides the current inline view. clears all inline clickers.
same functionality as add_clicker(), but for the inline view. use this in the on_load function for show_inline_view.
same functionality as remove_clicker() but for the inline view. note: hide_inline_view() removes every inline clicker automatically.
give the user a nice jumpscare, and end the game. (still needs sound!)
fun note: if the player tries to continue playing by pressing the back button, they get ANOTHER jumpscare and a reprimand for trying to CHEAT.
I have a debug variable set up right now. It prints the inventory in the top left corner, and outlines all the clickers in transparent yellow. If you want to turn it off, go into script.js and change
var debug = true;to
var debug = false;but be really careful about committing that tiny change to the github 'cause it could be really confusing idk