Back to the reference
Hooks
Everything a scene or an object asks for while it is being built: loading, input, cameras, lights, sound, state and the frame loop.
117 symbols
Game
Scenes
Lifecycle
useCleanupRuns when its owner goes away: the component it is called in when it is destroyed, or the scene when it stops.useLateUpdateRuns your code once per frame, after every useUpdate of the scene has run.useReadyRuns your code once, when everything being built with it exists: the whole scene, children and all, before its first frame.useSceneTransitionEndRuns your code once, when the transition this scene came in with is over: the screen uncovered and nothing left over it.useTimerRuns code later, in game time: once after a while, or again and again.useUpdateRuns your code once per frame, for as long as the scene is on screen.
Game objects
useSelfThe thing being built right now, so it can refer to itself later: almost always to end its own life once it has done its job.useSpawnPrepares a maker for component, so the scene can create as many of them as it likes, whenever it likes: while it is being built, from a frame, from a timer, from a click.useTransformGives this object a place of its own, and moves everything inside it.
Scripts
Input
useActionOne action, which is what most game code reads.useActionsThe game's named actions.useDirectionFour actions read as one direction: the way to move a character from the input map.useDraggableMakes a sprite, a text, a nine-slice, a set of shapes or a whole object follow the pointer that drags it: pressed with the main button or a finger, it moves with it, held where it was taken, until it is let go.useDropZoneMakes a sprite, a text, a nine-slice, a set of shapes or a whole object a place things can be dragged into: a slot of an inventory, the square of a board, a bin.useGamepadA gamepad, to ask in every frame what the player is holding, has just pressed, or how far a stick is pushed.useInputMapRemapping: what a game's controls screen is built on.useKeyboardThe keyboard, to ask in every frame what the player is holding or has just pressed.usePointerListens to the mouse and to touch: presses, releases, movement, and what is under the pointer.useTouchActionMakes what is being built an on-screen button for action: while a finger is on it, or on anything inside it, the action is held, and the game reads it like any other press, actions.isDown('jump'), whatever pressed it.
Store
State
useDataState that lives with a piece of the scene, as [data, setData].useStateMachineA finite state machine that lives with a piece of the scene: a character that is standing, running or jumping, an enemy that patrols, chases and goes back, a door, a boss, a level's phases.useWatchRuns your code on the first frame, and again whenever one of the things you listed changes.
Signals
Particles
Camera
useCamera2dGives the scene a camera, so its world can be bigger than the screen and scroll, turn and zoom.useCamera3dGives the scene a camera to look at its models through, and returns it.useCameraFollowMakes the scene's camera follow something, the way a platformer's does: a box in the middle the character moves inside freely (deadzone), never past the edges of the level (bounds), a little ahead of where it goes (lead), and a shake for when something hits hard.useFogPuts the scene in fog: its models fade into color between near and far from the camera.useParallaxMakes this object, and everything it draws and holds, move with the camera only so much: 1 as everything else, 0 not at all, as if pinned to the screen, and in between further away.useScreenSpaceKeeps what is created here fixed on the screen, even while the scene's camera moves.useWorldOffScreenHas the screen draw only what this scene pins to it (useScreenSpace): its world is seen through views of it alone (createSpriteTexture({ sees: 'world' })).
Masks
Filters
Lighting
useAmbientLightThe level everything is lit to before any lamp reaches it.useAmbientLight2dHow bright a 2D world is where no lamp reaches, and in what colour, apart from any 3D light.useBlobShadowPuts a soft dark disc on the ground under something and keeps it there.useDirectionalLightA light from far away, like the sun.useLight2dA lamp for a 2D world: it lights the sprites, texts, nine-slices, maps and particles around it, with no normal map.usePointLightA lamp: it has a place, shines every way, and fades out with distance.useRectLightA panel: a lamp shaped like a rectangle, which shines from its front only.useSpotLightA torch: a lamp that only shines inside a cone.useStudioLights the scene like a photographer's studio in one line, the lighting of the glossy product shots and toys of the era's computer graphics: a warm key light up to the right that casts the shadows, a cool panel filling from the left, a panel behind that draws a bright rim, and the light from all around in two colours, a sky above and a floor below.useUnlit2dLeaves what is created here out of the scene's 2D lights: it keeps its own colours however dark the world is, and still moves with the camera, unlike the HUD.
Geometry
useCircleGeometryA flat disc facing up.useConeGeometryA cone with a base.useCubeGeometryA cube, or any box shape: as wide, tall and deep as you ask, its edges sharp or cut off with a bevel: rounded, or a straight cut.useCylinderGeometryA tube with a lid and a base.useExtrudeGeometryA flat outline pushed out into a solid, as a cookie cutter goes through dough: a diamond, a star, a letter, a gear, a notched separator, a deflector, a frame with its window cut out.useIcoSphereGeometryA ball whose triangles are all about the same size.useLatheGeometryA shape turned on a lathe: half an outline, its profile, spun about the upright axis into a solid, as a turner shapes a chair leg or a potter a vase.usePlaneGeometryA flat sheet lying like a floor, facing up.useSphereGeometryA ball built as lines of latitude, the way a globe is drawn.useTorusGeometryA ring, like a doughnut.
Animation
useMotionPlays a motion on the scene this is called in: a .motion file of values moved over time by keys (a camera sweeping the field, a title coming in), made in an editor's motion panel.useSkeletalAnimationMakes a placed model move: plays the movements its file came with, and eases between them.useSpriteAnimationPlays a sprite's pictures in order, so it walks, attacks or spins.useTweenDeclares tweens: a number, or the fields of an object, going from one value to another over time, so something can slide in, grow, fade or bounce without you writing the arithmetic for it every frame.
Materials
useEnvironmentThe surroundings of a place, captured: the scene drawn round it as the six faces of a cube, for a model of chrome to reflect the room it is really in, the columns and the torches and the floor, rather than a picture of somewhere else.useMirrorA mirror: the world reflected in a flat surface, a polished floor, a mirror on a wall, a lake.
Post-processing
useOverlayDraws what is created here over the screen effects (usePostProcess, a project's post, a style's), untouched by them: a HUD that a bloom does not make glow, a menu that the blur behind it does not blur.usePostProcessnacatamalon/effectsAdds a full-screen effect: a shader that reads the finished frame and gives back what to show.
Color & palettes
Pixels
Audio
useAudioThe game's volumes: the general one and one per channel, plus a way to silence everything.useAudioListenerPuts the game's ears on this object: every sound placed in the world is heard from where it is, and in a 3D scene, facing the way it faces.useMusicPlays one piece of music recorded in several files (its layers, or stems) that sound together, and hands back the controls for it.useSongPlays a song written as notes (a .song file, or one written in code) with the engine's 8-bit synthesizer, and hands back the controls.useSoundPlays one audio file (.wav, .mp3, .ogg), or an effect made from a preset, and hands back the controls for it.
Assets & loading
useLoadAtlasLoads a sheet written as a file: the image, how it is cut into frames, and the named runs of frames over it.useLoadAudioLoads a sound, and hands it back at once, still loading, for useSound to play.useLoadBitmapFontLoads a bitmap font: an image with the characters drawn in it, and a file saying where each one is.useLoadFontLoads a vector font: a .ttf or .woff file, the kind a computer has installed.useLoadLutnacatamalon/effectsLoads a colour grading table.useLoadModelLoads a model made somewhere else: something sculpted in Blender, bought in a pack, exported from anywhere that writes glTF.useLoadMotionLoads a motion: a .motion file of values moved over time by keys, made in an editor's motion panel.useLoadPackLoads a pack: boxes and scenes somebody made in another project, with everything they need.useLoadPalettenacatamalon/effectsLoads a set of colours for an effect to match a frame against.useLoadParticlesLoads an effect: what a puff of smoke or a shower of sparks is made of.useLoadProgressKeeps count of what a scene is loading, for a loading bar or to wait before changing scene.useLoadSceneLoads a scene laid out in the editor: a .scene file.useLoadShadernacatamalon/shaderLoads a shader written in a file, so an effect can live beside the game instead of inside it.useLoadSongLoads a song written as notes: a .song file, a few kilobytes where the same tune recorded would be megabytes.useLoadTextureLoads an image to draw with, and hands it back at once, still loading: a sprite made with it appears by itself when the file arrives, so nothing has to wait for it.useLoadTrackerSongLoads a song made in a NES tracker, FamiTracker or FamiStudio, from its text export, and plays it on the engine's NES: the same song useLoadSong gives, for useSong, with its own tempo, key, pan and beats.
Tags
Hitboxes
useCollisionBetweenCalls callback for every thing of kind a touching one of kind b, every frame they touch: a rule of the scene, shots against enemies, the player against coins.useCollisionWithCalls callback with each thing the object being built touches, of one kind: a bullet and the enemies, the player and the coins.useHitboxGives this object a part that can be touched: what useCollisionWith, useCollisionBetween and collisionBetween measure it by instead of its picture.
Physics
useCharacterBody2dnacatamalon/physics2dMakes this object a platformer's character: the game says how fast it goes, and the world stops it at the map's walls, holds it on ledges and slopes, and lets it push what the simulation moves.useCharacterBody3dnacatamalon/physics3dMakes this object a walking character: a capsule moved by asking the world what is in the way, and the thing that makes a room walkable.useJoint2dnacatamalon/physics2dJoins two objects' bodies, or one to a point of the world when b is null: the planks of a bridge, a pendulum on its nail, a platform on a spring, a door on its hinge.usePhysicsBody2dGives this object a flat shape to collide with.usePhysicsBody3dGives this object a shape in three dimensions to collide with.usePhysicsWorld2dOpens the flat simulation for this scene, and says how hard things fall.usePhysicsWorld3dOpens the simulation in three dimensions for this scene.useRetroBody2dGives this object a retro body: one that never turns, moved in pixels a fixed step at a time and stopped against the others axis by axis, the way the old games did.useRetroWorld2dOpens the retro simulation for this scene, and says how hard things fall: in pixels per second squared with +y down, like the full flat simulation's.useSoftBody2dnacatamalon/physics2dMakes the object being built a soft body in the scene's 2D world: something that squashes, wobbles and rolls rather than keeping its shape.useTileBody2dMakes this object a platformer's character that walks on the scene's maps, with no physics engine: the game says how fast it goes, and the map stops it at walls, holds it on ledges and slopes, lets it climb ladders and carries it on belts.
Capture
Render
Math
Debug
useHelperAxisDraws the three axes as coloured lines from where it is placed: X red, Y green, Z blue, the colours every 3D tool uses.useHelperGridDraws a floor grid on the ground plane, the one every 3D editor shows, with its middle lines in the colours of the X and Z axes.useLinesDraws any lines you like.
Net
useNetnacatamalon/netThe network, for a scene of an online game.useNetSpawnnacatamalon/netA spawner for objects every game in the room sees: the server calls it, and the object is made there and, with the same arguments, in every player's game, now and for whoever comes later; when the server destroys it, it goes everywhere.useRoomStorenacatamalon/netThis game's store of a declaration made with createRoomStore: the room's own in the room, a copy the room keeps up to date in a player's game.useSharednacatamalon/netMakes the object being built one every game in the room sees: the server decides where it is and what its fields hold, and each player's game shows it there a moment later, gliding between what it was told.