Unofficial CodeSpells Documentation

The documentation listed here is not complete, and will be updated frequently, and after every update.

Much of this documentation was gathered and or prepared by: Burgy

Basics » Earth » Water » Fire » Air » Life »

Basic Functions

  //Ran when the user creates an orb with the spell, happens on left click.
  //The basic function for most spells, put your initial code in this function.
  //Triggered when an orb hits another game object.
  //Used for simple collision detection.
  //Triggered when the user presses the activate button (default ‘F’).
  //Used for user input in a spell.
orb.setTimeout(function to call, amount of milliseconds to wait)
  //Calls a specified function after a certain amount of time in milliseconds.
  //You can cancel the execution with the clearTimeout(timerId) method.
orb.setInterval(function to call, amount of milliseconds to wait)
  //Calls a specified function after every specified amount of milliseconds
  //Can cancel the execution with the clearInterval(timerId) method.
   Note:TimerID’s are generated if you create a new variable when calling the method such as var timerId = orb.setTimeout(function, 1000)
orb.createOrb(spell to call, earth mana, water mana, air mana, fire mana)
  //Calls a specified spell for a specified amount of mana in each category
  //Used to create separate orbs to do separate tasks from one spell
   Note: Naming the spell that spawns all the secondary orbs is a good idea for yourself and other users.
   Note: To use the creatOrb method you need to allocate at least 1 mana of each category in the spell creator window.
  //Self explanatory; destroys the active orb.
  //Used to stop a spell.
orb.orbitPlayer(distance from player, time per revolution)
  //Has the orb orbit the player at the specified distance and speed.
  //Generally used when an orb has a kinetic connection to a game-object to make that object orbit the player.
   Note: There is a method for orbiting the owner of the orb, which will orbit the creator of that orb, such as another orb: orb.orbitOwner(same parameters)
  //Self explanatory, stops the orb from orbiting the player.
  //Orbs will be shot off straight in the direction they were travelling previously.
  //Locks the orb to the center of the player’s FOV.
  //Can be used for precise movement of an orb, selection, etc.
   Note: to undo this method there is a counter method as follows: orb.unlockFromPlayerRotation()
  //Turns the orb in a specified direction by the method name a specified amount of degrees in the parameters.
  //Examples: orb.turnUp(45), orb.turnLeft(36), orb.turnDown(90), orb.turnRight(21)
  //Set’s the orb’s direction either straight up, down, left or right.
  //Used to re-orient the orb if you haven’t kept track of the changes in angle you have previously made.
  Note: There is also a orb.setRotationRandom() function for setting a random.
  //Points the orb directly at the player from any position.
orb.pointAt((new Vector3(x, y, z)))
  //Points the orb at a position in the world.
orb.createPhysicalConnection(object to connect to, “strength”)
  //Creates a connection between the orb and an object specified.
  //The connection can be broken which depends on the strength you set.
  //Easy way to attach a hit object is to use the onHit() function and the orb.getLastHitWorldObject() method.
  //Removes any connections the orb has.
  //Drops all connected objects.
  //Moves a game object to the active orb.
  //Returns the current player.
  //Returns the current player position.
  //Returns the current distance from the orb/object to the player.
  //Returns the creator of the orb, whether it be the player or another orb.
  //Used for when you cast another spell from within a spell, creating another orb.
  //Returns the current position of the orb creator.
  //Returns the current distance to the orb creator.
  //Returns the last object that the orb collided into.
  //Useful for collision detection and in the onHit() function.

Earth Magic

  //Changes the rock at the orb’s current position.
  //Can be positive or negative.
  //Lifts sand beneath the orb at whatever position the orb is at.
   Note: Alternatively there is the orb.lowerSand() method to combat the liftSand() method.

More documentation will come soon. We are currently focused on finishing the Blockly tutorial. For now, refer to the in-game documentation. Thank you for your patience.