Home Concepts / Development

Concepts / Development

GameSalad Documentation. Basic Concepts, Glossary, Etc.
By Tan Tran
8 articles

Glossary: Behaviors

- Action: These are behaviors that are not meant to fire continuously, such as movement, changing image, color, or size, or accepting keyboard input; they are best used when governed by a rule. - Behaviors: Behaviors are actions or states of being that apply to actors; they can change how actors move, look, sound, and act. - Accelerate: Specifies the speed and direction of acceleration for an actor. Actors will continue to accelerate unless drag is applied or another movement behavior takes precedence. - Accelerate Toward: Allows user to specify the precise location an actor will accelerate toward. - Animate: Displays a series of images in rapid succession to create animation. - Change Attribute: Allows user to set or change a game, scene, or actor attribute. For instance, users can create score-keeping systems, instructing the game to add points (or remove points) to a specific actor, or remove health/life from a player or actor. - Change Image: Change an actor’s image to a new image – useful for showing damage or other changes to an actor without having to create multiple actors. - Change Scene: Goes to a specific scene – useful for moving to the next level, a credits scene, or the game menu. - Change Size: Grows or shrinks an actor (use a negative number to shrink). Insert a timer container to control how long the growth or shrink should take. - Change Velocity: Specify movement changes relative to another actor or to the scene. - Collide: Use this behavior in conjunction with a tag to control which actor or groups of actors the primary actor will bounce against. - Constrain Attribute: Continuously updates an attribute – for instance,constraining the actor’s location to that of the mouse. Essentially ties two attributes together. - Control Camera: Allows users to cause the camera to follow an actor – keeping it in view. - Destroy: Removes the ACTOR from the scene – apply this rule to objects that can be destroyed, like the blocks in Breakout or the bricks in Mario. Best used with a rule – for instance, contact with the ball in Breakout. - Group: Creates a group container that holds a set of rules or behaviors. - Interpolate: Allows you to cause an attribute (location, value) to go from A to B in a set amount of time – for instance, from 100 to 1 (a countdown) or from position X to position Y (for pre-programmed movement). Note: Interpolating an Actor’s size does NOT change the size of its collision box to match. - Load Attribute: Loads the value stored by a custom key name from persistent storage. Allows users to change an attribute upon specific input or events. - Log Debugging Statement: Logs a statement in the debugging window. Statements can be attribute values for error-checking or text entry to flag an event when your game is running for testing purposes. - Move: Specifies movement in a particular direction relative to the actor or scene. Movement is perpetual unless stopped by some other rule or object. - Move To: Specify movement towards a particular X&Y coordinate; upon arrival the actor stops moving, or resumes any prior movement that the Move To behavior overrode. - Note: Allows users to write a note to self or other creators about a particular behavior, rule, actor, or group – useful or explaining why something is done a particular way. - Open URL: Only available to individuals with a Professional-level membership, this option allows the developer to specify a specific URL to open when a certain action takes place (we recommend a button being clicked or pressed). The URL will open in the user’s default browser. - Particles: Create an explosion! Radial or fountain of particles – can also set an image, color, lifetime, and other parameters. - Pause Game: This behavior will pause the scene by freezing all activity in a given scene and opening another scene that you specify. Use this to open up in-game menus or simply pause the action. Use “unpause” to resume the scene. - Pause Music: Pauses a currently playing music file upon a particular event. - Play Music: Triggers a music file to play – can play once or loop. - Play Sound: Triggers a sound file to play – can play once or loop - Prototype (Actor): A prototype actor is an actor that possesses all the overall governing behaviors, but does not possess some of the specifics that an Instance Actor possess (such as spawning location). - Replicate: Creates copies of an actor based on an attribute or integer. Useful for displaying the number of lives a player has left, having an item duplicate itself, and much more. - Reset Game: Resets the game and all scenes (best used with a rule to specify WHEN or HOW this happens) - Reset Scene: Resets the current scene and all actors in it (best used with a rule to specify WHEN or HOW this happens) - Rotate: Alone, this causes consistent clockwise or counter-clockwise rotation. Can also cause an item to only rotate when an event happens, such as pressing a keyboard key or collision with another actor. - Rotate to Angle: Causes rotation to an angle relative to another actor or to a scene. - Rotate to Position: Causes rotation to a specific XY coordinate on the screen or relative to actor. - Rule: Creates a condition or set of conditions to check for player input or an attribute change. - Save Attribute: Save a particular value into persistent storage with a custom name. Allows users to save games (see “Load Attribute” for information on loading saved information) - Show iAd: Shows an ad whose text and destination is determined through Apple’s iAd system. - Spawn Actor: Creates a new actor instance in the scene – useful for projectiles, dropping items, etc. - Stop Music: Causes a music file to stop playing. - Timer: Timer allows you to perform behaviors or rules at specified intervals. These intervals are defined as after a certain number of seconds, every couple of seconds, or for a certain number of seconds.

Last updated on Jul 07, 2025

Glossary: Attributes

Built-In Game Attributes 1. Name: The name of the project. 2. Time: An attribute that will update with the amount of elapsed time the game has been running. 3. Display Size: The default size of the scene/camera when you create a new scene. 4. Random Seed: This value is used to initialize the pseudorandom number generator. When a seed is used, the sequence of random numbers that are generated will always be the same. For example if you got 5 random numbers with a seed of '3' (the numbers generated were 1, 7, 2, 5, 32). Then every time you preview or run the game, those would be the same first 5 random numbers to be generated. By default the seed is set to -1 which will randomize the seed every time the game is run. 5. Ad Rewards Value: When reward ads are set up for the project, this will update with the value the game gets back from the ad provider. (i.e if you configured the value to be 100 on the ad providers side, then this would update to be 100 when a reward ad is viewed) 6. Ad Rewards Name: When reward ads are set up for the project, this will update with the name of the ad provider when an ad is watched. 7. Game Multiplayer Type: This value defaults to single player, but needs to be set to multiplayer for the networking behaviors to work. Built-In Scene Attributes 1. Name: The name of the scene. 2. Time: An attribute that will update with the amount of elapsed time that the scene has been running. 3. Scene Size: The size of the scene. 4. Wrap X: Toggling this attribute on will cause actors that move off the left or right side of the scene to instead loop around to the other side. 5. Wrap Y: Toggling this attribute on will cause actors that move off the top or bottom of the scene. 6. Gravity: Applies an acceleration to every movable actors on the scene based off of the filled in X and Y values. 7. Color: Sets the background color of the scene. 8. Camera Attributes - Origin: The X and Y values of the starting place of the camera. 9. Camera Attributes - Size: The size of the camera. By default the camera will be the same size as the scene. 10. Camera Attributes - Tracking Area: The area an actor controlling the camera can move before the camera starts to follow it. (Note: This is only important if your scene is larger than the camera, otherwise the camera has nowhere to move.) 11. Camera Attributes - Rotation: Sets the rotation of the camera. Can be used for some neat swirling effects of the whole scene. 12. Auto-Rotation Orientations: These values determine the allowed orientations of the project on an Android device. By default only landscape left is selected. Built-In Actor Attributes 1. Name: The name of the actor. 2. Time: The amount of time since the actor has loaded. 3. Size: The size of the actor prototype. Setting the width and height here will determine what size the actor appears at by default when an instance of the actor is added to a scene. 4. Rotation: The rotation of the actor. 5. Color: The color and alpha (opacity) of the actor. 6. Image: Lists the default image for the actor prototype. 7. Tags: List of custom tags for the actor. Adding tags to actors allows you to create rules that reference a set of actors based off of their tag instead of a bunch of individual actors. i.e if you are building a platformer game, you could have all of the hazards the player needs to avoid tagged as "Hazards", then have a rule run when the player collides with an actor with tag "Hazards", instead of a rule for each hazard in the game. 8. Preload Art: This tells the engine to load the art used for this actor at the start of the game. If you have a large game, toggling this off may help with startup load times. Built-In Actor Attributes - Graphics 1. Visible: This sets whether or not the actor is visible on the scene (by default toggled on). This is different than the Alpha value of the actor, because if this is toggled off text isn't displayed, whereas if the alpha of an actor is set to 0, text will still show up. 2. Blending Mode: Determines how the colors behind the actor on the scene impact the actor. Some info about specific blending modes can be found on Wikipedia 3. Horizontal and Vertical Wrap: These values determine how the image applied to the actor behaves when the actor has a different aspect ratio than the image. - Stretch - By default the actor will stretch and skew the image to fit the size of the actor. - Fixed - This will cause the image to stay at its fixed aspect ratio regardless of the actor size. - Tile - When the actor is larger than the tile width or tile height bounds the image will start to repeat itself instead of skewing. (Note: A tile width and height need to be set for this to work.) 1. Horizontal Anchor: This value determines where the image on the actor will be anchored to when the horizontal wrap is set to something other than stretch. 2. Vertical Anchor: This values determines where the image on the actor will be anchored to when the vertical wrap is set to something other than stretch. 3. Flip Horizontally: Toggling this on will flip the image on the actor over the Y axis. 4. Flip Vertically: Toggling this on will flip the image on the actor over the X axis. 5. Tile Width and Height: These values are used when the horizontal or vertical wrap is set to tile. When the actor is larger than the bounds set here, it will begin tiling the image. Built-In Actor Attributes - Physics 1. Density: How dense the actor is treated in the physics engine. Learn more about density here. 2. Friction: This value determines how much an actor slows down when colliding with another actor. Zero friction results in no loss of velocity, while a higher friction value will cause the actor to slow down quicker. 3. Bounciness: Determines how much bounce an actor has when it collides with another actor. Zero bounciness results in the actors not bouncing off each other. A higher bounciness value results in the actors' velocities increasing in the opposite direction of the collision. 4. Fixed Rotation: Toggling this attribute on will stop the actor from rotating when colliding with other actors. 5. Movable: Toggling this attribute off will stop the actor from being able to move. (Note: This also stops the actor from rotating as that is a form of motion.) 6. Collision Shape: This value tells the physics engine what type of shape to draw around the image on the actor for collisions. - Rectangle - The default. The physics engine draws a rectangle around the image on the actor and uses that as the collision shape. - Circle - The physics engine draws a circle around the image on the actor and uses that as the collision shape. - Custom - If you've made your own collision shape (as a json file) you can select custom to import it. Alternatively you can select custom and then select "auto-trace" to have the physics engine draw a custom collision shape to fit the image on your actor. 1. Drag: Drag is the tendency of an object to slow down due to friction with the air or water that surrounds it. Having a higher drag value will cause the actor to slow down faster when not colliding with any other actors. 2. Angular Drag: This value slows down the rotation of an actor over time to simulate air-resistance. 3. Can Sleep: Toggling this value off will cause the physics engine to constantly factor this actor into physics computations, even when the actor is not actively colliding with anything. Leaving the value turned on will allow the engine to ignore actors that aren't actively colliding from the physics computations and improve project performance. 4. Better Collisions: Toggling this value on will cause the physics engine to run more computations per second when computing collisions with this actor. This will impact performance of the project, and is not suggested to be used on many actors. Built-In Actor Attributes - Motion 1. Linear Velocity: These attributes store the X and Y velocity of the actor. 2. Center of Mass: These attributes store the X and Y position of the center of mass of the actor for use in physics computations by the engine. By default the center of mass for an actor is its center point. 3. Angular Velocity: This attribute stores the rotational velocity of the actor. A positive value results in a counter-clockwise rotation, and a negative value results in a clockwise rotation. 4. Max Speed: If the enforce max speed attribute is turned on, this attribute sets the upper limit for the velocity of the actor. 5. Enforce Max Speed: When turned on, sets the max speed attribute as the maximum velocity for the actor. 6. Pin to COM: Turning this on locks the actor to a spot on the scene based off of its center of mass (by default the center of the actor).

Last updated on Jul 07, 2025

How Do I Use The Javascript Delegate System For HTML5 Games?

Engine Startup Life Cycle GameSalad has a delegate system that will allow you to hook into certain events in the GameSalad Engine. When GameSalad is done loading the engine, it calls the global (or window) function onEngineLoad. window.onEngineLoad = function () { } At this point you have access to the global variable gse (GameSalad Engine). This isn’t an instance of the engine, but a point of access to the engine. The next thing to happen is that you can register a callback function that is run when the engine is “Ready”. You can do this by calling the gse.ready() method and passing a callback function. The argument to this callback function IS the actual engine instance that is running the game. window.onEngineLoad = function () { gse.ready(function (engine) { // Environment specific init code goes here. }); } Now let’s look at this engine instance. In default-index.html you will see a lot of code inside the ready callback. All this code does stuff that is specific to the platform (because the HTML5 engine is used in more than just websites, the code here can look different). Here are the basics of what’s usually in there. window.onEngineLoad = function () { gse.ready(function (engine) { // Environment specific init code goes here. engine.setRenderFrame('gse-player'); // The ID of the DIV that will contain where the game renders. // Options for how the engine tries to adjust the window size and how it renders. engine.setOptions({ 'viewport-reference': 'window', 'Viewport-fit’: 'letterbox' }); // This loads any options passed as query parameters. You can usually omit this. engine.loadOptionsFromURL(); // This loads the game. engine.load(); }); } Handling Game Events with Delegates Now, let’s look at the delegates. The GameSalad engine object has a method called engine.appendDelegate that takes a HashMap of functions. Possible functions are documented here: https://helpdesk.gamesalad.com/hc/knowledge-base/articles/1751906411-glossary-functions Here is a minimal implementation that covers what do while the engine is in a “loading” state (i.e. before the game begins or between scenes). window.onEngineLoad = function () { gse.ready(function (engine) { // Define delegates // Get a reference to a div that shows a loading indicator. var loadingElement = document.getElementById('gse-loading'); const playerDelegate = { onLoadingBegin: function() { console.log("Loading begin."); engine.showOverlay(); // Signals engine to show the internal loading indicator. loadingElement.style.visibility = 'visible'; // Make our own overlay visible. }, onLoadingEnd: function() { loadingElement.style.visibility = 'hidden'; // Hide our own overlay engine.hideOverlay(); // Signals the engine show the internal loading indicator. } } engine.appendDelegate(playerDelegate) // Environment specific init code goes here. engine.setRenderFrame('gse-player'); // The ID of the DIV that will contain where the game renders. // Options for how the engine tries to adjust the window size and how it renders. engine.setOptions({ 'viewport-reference': 'window', 'Viewport-fit’: 'letterbox' }); engine.loadOptionsFromURL(); // This loads any options passed as query parameters. You can usually omit this. engine.load() // This loads the game. }); } To handle more functions, you add functions that match the spec in our doc to the player delegate. Writing Values To Engine with postEvent Finally, how to send information INTO the engine. The engine has a postEvent method, which lets you tell the engine certain things have happened. You can use two events: 'externalWriteGameAttribute' and 'loadExternalImage' For ‘externalWriteGameAttribute’ the postEvent arguments are as follows: engine.postEvent('externalWriteGameAttribute', null, <attribute path>, value) is a string that tells the engine what attribute to set. You can only set game level attributes and for custom attributes (attributes you create), you will need to know the internal ID of the attribute. You can find this by hovering over the name of the attribute in Creator 2. For image replacement you will call it as follows: engine.postEvent('loadExternalImage', null, <image name>, url); loadExternalImage only replaces existing images in the engine. is a string with the name of the image that you see in the Creator image library.  The URL is a string with the URL of the image. Example: Ad Network Support A common request is how to allow GameSalad to use different ad networks as part of a web arcade. We’ll use Lagged SDK as an example, because that’s one of Google Adsens’s partners. First you’ll need to load the ad library, so we’ll need to add something like this in our sample-index.html / index.html file inside the block: <script type="text/javascript" src="https://lagged.com/api/rev-share/lagged.js"></script> Next we’ll want to implement a delegate to actually show the interstitial or rewarded ad: window.onEngineLoad = function() { // This initializes the LaggedAPI with your own keys. LaggedAPI.init('YOU_DEV_ID', 'YOUR_PUBLISHER_ID'); // We're going to ask Lagged if there are reward ads available and tell it what to do when the ads are displayed. // When Lagged figures out if ads are available it will return ad availability and a function to show the ad. // We'll want to store the function to show ads later. let showRewardAds = null; function onRewardAdAvailable(adsAvailable, showAdFunc) { // No ads available, let's null out the function. if (!adsAvailable) { showRewardAds = null; return; } // Set up a function to display ads showRewardAds = function() { // Pause the game gse.pauseGame(); // Show ads using Lagged's ad function showAdsFunc(); } } // This handles the response when the ad is complete. function onRewardAdComplete(rewardUser) { // Check if the user should get the reward if (rewardUser) { // Set the gamesalad adReward attributes engine.postEvent('externalWriteGameAttribute', null, 'game.attributes.adReward.name', 'Reward Ad'); engine.postEvent('externalWriteGameAttribute', null, 'game.attributes.adReward.value', 10); // Adjust this to your actual reward. } // Check to make sure we have another ad available. LaggedAPI.GEvents.reward(onRewardAdAvailable, onRewardAdComplete); // Resume the game. gse.playGame(); } // Grab ad availability for the first time: LaggedAPI.GEvents.reward(onRewardAdAvailable, onRewardAdComplete); gse.ready(function(engine) { // Define delegates // Get a reference to a div that shows a loading indicator. var loadingElement = document.getElementById('gse-loading'); const playerDelegate = { onLoadingBegin: function() { console.log("Loading begin."); engine.showOverlay(); // Signals engine to show the internal loading indicator. loadingElement.style.visibility = 'visible'; // Make our own overlay visible. }, onLoadingEnd: function() { loadingElement.style.visibility = 'hidden'; // Hide our own overlay engine.hideOverlay(); // Signals the engine show the internal loading indicator. }, onSceneAboutToChange: function(sceneKey, sceneName, adType)) { if (adType === 1) { // Display interstitial gse.pauseGame(); LaggedAPI.APIAds.show(function() { // Resume game when done. gse.playGame(); }); } else if (adType === 2) { // Display rewarded ads if available if (showRewardAds != null) { showRewardAds(); } } } } engine.appendDelegate(playerDelegate) // Environment specific init code goes here. engine.setRenderFrame('gse-player'); // The ID of the DIV that will contain where the game renders. // Options for how the engine tries to adjust the window size and how it renders. engine.setOptions({ 'viewport-reference': 'window', 'Viewport-fit': 'letterbox' }); engine.loadOptionsFromURL(); // This loads any options passed as query parameters. You can usually omit this. engine.load() // This loads the game. }); }

Last updated on Jul 07, 2025

GameSalad Github Repos & Glitch project.

GameSalad has a number of github repos and glitch projects that can help expand what you can do with GameSalad: Library Repos GSTables-JS A javascript library that helps you parse and create tables suitable for use with GameSalad's Table Network Behaviors. https://github.com/gamesalad/gstable-js GSTables-PHP A php. library that helps you parse and create tables suitable for use with GameSalad's Table Network Behaviors https://github.com/gamesalad/gstable-php GameSalad Tables w/ Fast API (Python) A glitch example api that uses python's Fast API library to provide an API to work with GameSalad's Table Network Behaviors https://glitch.com/edit/#!/gamesalad-tables-fastapi GameSalad Groundhog API Using the above FastAPI project as a starting place, this project pulls data from groundhogday.com's API an formats it for a GameSalad table that will use it to visualize Groundhog Day results https://glitch.com/edit/#!/gs-groundhog-api Google Sheets to GameSalad Table Wire Format Gist This gist has code you can import into your Google Sheet that will allow your google sheet to be an API that servers table data to your game. Because of the inherit limits of google docs, this should only be used for internal testing or for internal / personal apps that need to collect or read data. If you want to use this to manage live game data for bigger games, you should consider putting it behind a caching proxy that will reduce the number of hits directly to Google Docs. https://gist.github.com/tant42/add5a37bd3143974362c981ff3d3fb4b Boilerplate Repos GS Webpack This boilerplate project lets you code delegates and package your GameSalad HTML5 Apps with the help of webpack. This will allow you to easily pull in npm packages and see changes as you develop through hotreload. https://github.com/gamesalad/gs-webpack GS Tauri This boilerplate project helps you quickly get your apps packaged as desktop apps using Tauri. Tauri hybrid web/desktop app packager that uses the operating system's native web component so you don't have to deploy a whole web brower with your desktop HTML5 app, reducing download size. https://github.com/gamesalad/gs-tauri GS Electron Forge This boilerplate project helps you quickly get your apps pacakge as desktop apps using Electron. Electron packages chromium and your javascript for a complete desktop app. It is used by apps such as VSCode to take javascript based apps and make them into desktop apps. https://github.com/gamesalad/gs-electron-forge

Last updated on Jul 07, 2025

Glossary: Functions

1. Function: Functions are various mathematical formulas available through the expression editor that allow you to have the Creator calculate sines, cosines, logs, and much more. 2. abs (Function): provides the “absolute value” of a number. In other words, it will make a negative number into a positive number. For example, abs(-5.23)=5.23. 3. acos (Function): This is the trigonometric arccosine (inverse cosine) function. Values for x should range from -1 to 1, with results from 180 to 0, respectively. Any other input values will result in ‘nan’. 4. asin (Function): This is the trigonometric arcsine (inverse sine) function. Values for x should range from -1 to 1 with results from -90 to 90, respectively. Any other input values will result in ‘nan’. 5. atan (Function): This is the trigonometric arctangent (inverse tangent) function. Results will range from -90 to 90. 6. ceil (Function): The integer when you round up a value. For instance, ceil(0.3095)=1, ceil(9.2850)=10, and ceil(-3.5)= -3. 7. cos (Function): This is the trigonometric cosine function. cos(0)=1. For more information on sine and cosine, see http://en.wikipedia.org/wiki/Trigonometric_functions 8. exp (Function): The exponential function e^x, where e is approximately 2.71828182818. For more information, see http://en.wikipedia.org/wiki/Exponential_function 9. floor (Function): The integer when you round down a value. For instance, floor(1.5)= 1, floor(9.2850)= 9, and floor(-3.5)= -4. 10. In (Function): The natural logarithm of a value. The natural logarithm is the logarithm to the base e, where e is approximately 2.71828182818. For more information, see http://en.wikipedia.org/wiki/Natural_logarithm 11. log10 (Function): The base 10 logarithm of a value. For instance, log10(10)=1, log10(100)=2. For more information, see http://en.wikipedia.org/wiki/Logarithm 12. magnitude (Function): Finds the length of a line segment drawn directly from the origin 0,0 to the given point. You can also include an offset to find the length between two points – for example, magnitude(x-x’,y-y’). If you have one actor at 100, 240 and another at 25, 30, you can find the distance between them with magnitude(25-100,30-240). 13. max (Function): Returns the higher value of the two numbers or variable units. This can be very useful for determining if a new score is higher than an existing score, or for other similar comparisons. For example, max(12,35)=35. 14. min (Function): Returns the smaller value of the two numbers or variable units. For example, min(12,35)=12. 15. padInt (Function): Displays an integer with the specified number of digits. For instance, padInt(32,5) will display 00032. However, padInt(38025,2) will display 38025. It will always display at least the minimum number of digits needed to retain the value of x. 16. padReal (Function): Displays a floating point with padding and precision. For instance, padReal(9.1234,15,6) will display 9.1234 with at least 15 total digits (including the decimal) and at most 6 digits to the right of the decimal. – 00000009.123400. 17. pow (Function): Returns the value of x to the power of y. For example, pow(2,3)=222=8. 18. precision (Function): Displays a floating point number with the specified number of decimal places. For instance,prec(1234.234,2) will display 1234.23. 19. random (Function): Returns a random integer equal to or between the first integer and the second. For instance, random(1,5) could return any of the following values: 1,2,3,4,5. 20. sin (Function): The trigonometric sine function. This is similar to the cosine function, but is offset by one quarter of a wave cycle. For more information, see http://en.wikipedia.org/wiki/Trigonometric_functions Tip: if you use the sine function and start your incrementing variable at 0, your actor’s movement does not start at the middle point between the minimum and maximum points of the wave. 21. sqrt (Function): Provides the square root of a value. Input values less than 0 will result in ‘nan’. 22. tableCellValue (Function): Returns the value of a cell of a selected table at a certain row and column. Tables are numbered starting at 1. You can also use the row or column name as an input for this function. For example, tableCellValue(game.Data,1,15) will return the value in table, Data, at row 1 and column 15. 23. tableColCount (Function): Returns the number of columns in the selected table. 24. tableColNumber (Function): This will return the column number with the given column label. 25. tableColSum (Function): Returns the sum of the table cells in a given column between the starting row and ending row. This only works on numerical type columns (integer, real, angle). 26. tableMergeValues (Function) – This will return a string value with the concatenated values from a given column or row (depending on the setting in the 2rd parameter). If the start range is greater than end range, then it will go from last value to first value, appending to the end. The separator will be concatenated between each value. 27. tableRowCount (Function): Returns the number of rows in the selected table. 28. tableRowNumber (Function): This will return the row number with the given row label. It will return 0 if it doesn’t exist. This is useful if you want to jump to a section of a table and start iterating through rows from there. 29. tableSearch (Function): Searches a given column or row (depending on the setting in the 3rd parameter), and returns the index for the first instance of the given key (or keyword) where a match is found (also depending on the match type as set in the 7th parameter). It will search between the specified range. If the start range is greater than the end range, it will do a reverse search. A “0” will be returned if the key value is not found. If you specify “not” in front of the last parameter, it will check against the opposite search.For example,tableSearch(game.table,”yes”,”row”,1,1,10,”exact”)will look for the first instance of “yes” in a cell value in row 1 between columns 1 and 10, and return the column value. While tableSearch(game.table,”yes”,”row”,1,1,10,”notexact”)will return the column number where the cell value is not exactly “yes”. 30. tan (Function): The trigonometric tangent function. For more information, check outhttp://en.wikipedia.org/wiki/Trigonometric_functions 31. textFind (Function): Returns the index of the location of the text, pattern, in the text attribute, text, starting the index startIndex. If the text was not found, it returns “-1”. CASE SENSITIVEUsage: Given a text attribute with the value “the quick sly fox jumped over the lazy dog.” textFind(self.Text,”the”,1) returns the value 1. However, textFind(self.Text,”the”,2) returns the value 31. 32. textLength (Function): This returns the length of the text or numerical attribute 33. textRepeat (Function): Returns a text which repeat the text attribute, text, n times, where n is a non-negative integer value.Usage: Given a text attribute with the value “yo”, textRepeat(self.Text,2) returns the value “yoyo”. You can also enter the text directly into the function and use an expression for the n value. For example: textRepeat(“buffalo”,mod(self.Time,3)) will return either “buffalo” or “buffalo buffalo” depending on the time. 34. textReplace (Function): This will return the text or text attribute, text, with the first instance of text value, pattern, with text value, replacement.Usage: Given you have a list of separated values in a text attribute like, “s01s02s03s04s05s”, you can replace “s02s” with “s” to signify that question 2 has already been used. See the textSubStr for more usage. 35. textReplaceAll (Function): This works just like the textReplace function but will return a text value with ALL instances replaced. 36. textSubStr (Function): This returns a text which is the substring of attribute, text, starting from index startIndex and ending at index endIndex.Usage: Given a text attribute with the value “the quick sly fox jumped over the lazy dog.” textSubStr(self.Text ,5,8)returns the value “quic”. You can also use this to extract a random set of numbers from a string and use that as a way to choose a unique question via table row number. 37. vectorToAngle (Function): Finds the angle relative to the origin 0,0, given an X and Y coordinate. For instance, vectorToAngle(100,200)=63.435. You can also find the angle relative to an offset. For instance, vectorToAngle(x-x’,y-y’). VectorToAngle(100-200,150-250) will find the angle between the points 100,150 and 200,250, or -135 degrees. 38. round (Function): The integer when you round to the nearest. If exactly 0.5 between two integers, the result is the greater. For instance, round(1.5)= 2, round(9.2850)= 9, and round(3.7)= 4. 39. roundTo (Function): Round a real number to a specific decimal digit. Unlike the precision function, the return value is still a number, not text. To pad the decimal with 0’s for display purposes, use the precision function instead. Examples: roundTo(0.12345, 3) = 0.123; roundTo(2.5, 0) = 3; roundTo(4, 2) = 4;

Last updated on Sep 23, 2025

Glossary: Terms

Here is a list of terminology used in GameSalad, including behaviors & functions, and what these terms mean: 1. Accelerometer: Determines the angle and rate of movement of the device; useful for determining when a user rotates or tilts their device. 2. Actor: All the items (both visible and invisible) in your game are actors; they are governed by Behaviors that control how they interact with both other actors as well as with people playing your game. In other game engines, these would be known as sprites or game objects. 3. Actor Attributes / Instance Attributes: Attributes that belong to an actor. Actor attributes are only available to the actor itself and cannot be read by other actors. They are unique for each instance of the actor, so they're good tracking actor specific values. 4. Actor Mode: This is the default mode for the scene editor, and allows the actors to be placed, moved, rotated, and resized in the scene. 5. Actor Tag: Actor Tags are used to categorize actors; they can be added and removed through the Project Editor. 6. Alpha Color / Alpha Channel: Alpha represents the transparency of an actor, and can be set to any real number between 0 and 1, with 0 being completely transparent and 1 being completely opaque. "Alpha" comes from the mathematical concept of linear interpolation, which uses the Greek letter alpha (α) to represent the weighting factor between two values 7. Attribute: Attributes contain numeric or text values that govern various aspects of the game, scene, and actors. 8. Behavior Library: A list of all available behaviors which can be assigned to actors. 9. Camera Mode: An alternative mode while editing a scene, Camera mode allows the user to set the sensitivity and range of the camera’s movement. 10. Collision Shape: This option determines whether other objects will collide with this object as if it were round (or rounded), or square (or rectangular). 11. Custom Attributes: Attributes that are created by the game creator as opposed to ones build into the game engine. 12. Density: Density refers to the heaviness of the actor. A higher value will make the object harder to move by less dense actors. A value of 0 will make an object immovable but still affect other actors in the scene. Density can be set to any real positive number. (i.e.Density >= 0) 13. Devices: The Devices pane (under the “Game” tab in the Scene Editor) allows you to change various attributes relating to the device, including mouse, touch, accelerometer, screen, and audio. 14. Display Text (Behavior): Allows users to change the color, size, font, and other elements of text displayed in-game. Change “alpha” to 0 (found under color in the attributes list) to make all parts of the actor invisible other than the text. 15. Editor: Can refer to one of three editors: the Project Editor, the Scene Editor, or the Actor Editor. 1. The Project editor is used for editing overall detail about your game. 2. The Scene Editor is used for creating your scenes by placing actors, changing various attributes, setting tags, and more. 3. Actor editor is used for changing a variety of attributes about your actors. 16. Fixed Rotation: Selecting this option will prevent the object from rotating when it collides with other actors in the scene. Leaving this box unchecked means that the actor will rotate normally when it collides with other actors. 17. Friction: Increasing this number will slow this object down more when it interacts with other objects. Set to 0 for no friction (and hence no slowing). 18. Game Attribute: Attributes accessible to all actors in the game. These are, in effect, global variables. 19. GameSalad Creator: The best software in the world for making games with no coding! 20. Gravity: Each scene can be set up with an X and Y gravity attribute.These are real numbers that affect all actors which are Movable. 21. Image Library: A repository of .png assets that have been imported into the GameSalad Creator. 22. Instance (actor): An instance is a unique example of an actor, with altered behaviors, attributes, or abilities from the prototype actor. 23. iOS: The operating system created by Apple, Inc. to run on the iPhone, iPad, and iPod Touch. 24. Layers: Layers allow you to prevent actors from interacting with each other – this can allow you to create backgrounds, scores, and more without having the player’s actors bump into them. 25. Logic: A term which refers to the combination of rules and behaviors that jointly define how a project operates. 26. Max Speed: This attribute controls the maximum speed an actor can reach through acceleration and gravity. Please note that some behaviors, such as Change Velocity and Interpolate, will override Max Speed. 27. Movable: Allows you to specify that an actors is able to move (or not able to move) when interacting with other actors. (Check the box to allow it to move) 28. Orientation: This determines whether your game runs in “up and down” mode (portrait) or “side to side” mode (landscape) on iDevices (iPhone, iTouch, iPad). 29. Otherwise: An optional component of a rule; behaviors placed under this heading will trigger whenever the conditions of the Rule are not valid. 30. Particles: Particles are small objects that move out from the actor in a defined way. See “Particles” Behavior for more information. In a game engine particles meant to be light weight graphics elements to allow the system to display a large number of them on the scene with minimal performance impact. 31. Platform: The devices or locations where your game will be able to run. Platforms that are currently available include iOS, Mac Desktop, Android, and HTML5. 32. Preview: Allows you to see how your game will look and run instantly! Can be done both in GameSalad and in a browser window. Use often to ensure that the rules and actions you are giving your actors are working properly. 33. Project Size: The current memory needs of your project can be found in the bottom-right corner of the GameSalad Creator. The recommended maximum size for GameSalad Arcade games is 20 MB 34. Publish: Publishing uploads your game to GameSalad’s servers, where it is turned into a binary that you can then submit directly to Apple, GameSalad Arcade, or an Android store. 35. Resolution Independence: Allows your game to be displayed in low or high resolution, depending upon the capabilities of the device 36. Bounciness / Restitution: Makes your actor bouncy – 0 is no bounciness; 2 is superball bouncy. Any real positive number from 0 to 2 can be used. In the physics engine this is the restitution value, the ratio of relative velocity between two objects after a collision compared to their relative velocity before the collision. 37. Scene Attributes: These are attributes that specifically affect a scene, rather than an actor or the entire game. They include Name, Time, Size, Wrap X, Wrap Y, Gravity, Color, Camera, and Autorotate. 38. Keyboard Input: Saves keyboard input text into a specified attribute. 39. Unpause Game (Behavior): This behavior removes the pause screen and resumes the paused scene.

Last updated on Sep 25, 2025

GameSalad Github Repos & Glitch project

GameSalad has a number of github repos and glitch projects that can help expand what you can do with GameSalad: Library Repos GSTables-JS A javascript library that helps you parse and create tables suitable for use with GameSalad's Table Network Behaviors. https://github.com/gamesalad/gstable-js GSTables-PHP A php. library that helps you parse and create tables suitable for use with GameSalad's Table Network Behaviors https://github.com/gamesalad/gstable-php GameSalad Tables w/ Fast API (Python) A glitch example api that uses python's Fast API library to provide an API to work with GameSalad's Table Network Behaviors https://glitch.com/edit/#!/gamesalad-tables-fastapi GameSalad Groundhog API Using the above FastAPI project as a starting place, this project pulls data from groundhogday.com's API an formats it for a GameSalad table that will use it to visualize Groundhog Day results https://glitch.com/edit/#!/gs-groundhog-api Google Sheets to GameSalad Table Wire Format Gist This gist has code you can import into your Google Sheet that will allow your google sheet to be an API that servers table data to your game. Because of the inherit limits of google docs, this should only be used for internal testing or for internal / personal apps that need to collect or read data. If you want to use this to manage live game data for bigger games, you should consider putting it behind a caching proxy that will reduce the number of hits directly to Google Docs. https://gist.github.com/tant42/add5a37bd3143974362c981ff3d3fb4b Boilerplate Repos GS Webpack This boilerplate project lets you code delegates and package your GameSalad HTML5 Apps with the help of webpack. This will allow you to easily pull in npm packages and see changes as you develop through hotreload. https://github.com/gamesalad/gs-webpack GS Tauri This boilerplate project helps you quickly get your apps packaged as desktop apps using Tauri. Tauri hybrid web/desktop app packager that uses the operating system's native web component so you don't have to deploy a whole web brower with your desktop HTML5 app, reducing download size. https://github.com/gamesalad/gs-tauri GS Electron Forge This boilerplate project helps you quickly get your apps pacakge as desktop apps using Electron. Electron packages chromium and your javascript for a complete desktop app. It is used by apps such as VSCode to take javascript based apps and make them into desktop apps. https://github.com/gamesalad/gs-electron-forge

Last updated on Sep 25, 2025

Customize HTML5 Engine Games With Code?

There is limited interaction a user can have with the HTML5 engine. This is and advanced feature, so our support team may not be able to help you quickly. Before using these features or reaching out to our support team, please make sure you have an intermediate to advanced understanding of javascript and how it works in the browser. The most comprehensive example of how to uses these types of features lives in the sample-legendsoflearning.html file included with your HTML5 package. Change Engine State The following functions are available: gse.pauseGame(); // Pauses the Game gse.playGame(); // Resumes the Game gse.resetGame(); // Resets the Game gse.getGameVolume(); // Gets the engine volume You can also write functionality to control the volume of the game inside the gse.ready callback.  Inside that callback you can call the following two functions: gse.setGameVolume(engine, volume[0-1]); // Sets the volume for the whole game. Must be called where the engine context is available. This can be hooked up in the gse.ready callbackback function.  This must happen inside the gse.ready callback, because you can only set the volume after the engine has initialized. Handle Engine Events via Delegates On the sample-index.html file provide, inside the gse.ready callback function, you will see a playerDelegate object which has 3 delegate functions defined. These two actually trigger on engine events: Life Cycle Delegates onLoadingBegin: function() // define what you want to happen while the engine is loading a scene onLoadingEnd: function() // define what you want to happen when the engine is done loading a scene onCurrentSceneChanged: function(sceneKey, scenename) // define what extra actions to take when the scene changes. good for analytics or ads onSceneAboutToChange: function (sceneKey, sceneName, adType) // lets you know before a scene changes. good for analytics or ads onEndGame: function() // Called when the end game behavior is triggered. External Behavior Delegates onShowBannerShow: function(position[‘top’|’bottom’]) // Triggered by the Show Banner Ad Action. Use this to trigger code to show ads. onTweetSheet: function(message, image) // Triggered by Tweet Sheet Action. One of the most flexible delegates, can be used to trigger almost anything based on the values of the message and image fields. onLogDebuggingStatement: function (text, entity) // Called when log Debug Statement action is triggered. IAP Delegates onIAPBuyItem: function (itemInfo) //  itemInfo: {itemID, consumable, name, price, state}. Return a promise that rejects if the purchase fails and resolves with the following json object: {buyerCancelled: (true || false), purchaseComplete: (true || false)}. onIAPRestoreItems: function () // Returns a promise. Resolves with purchases object. Purchases is an array of objects containing the key itemID for all items purchased. onIAPConsumeItem: function (itemInfo) // itemInfo: {itemID, consumable, name, price, state}. Return a promise that rejects if the purchase fails and resolves if the purchase is a success. onIAPRequestPurchaseData() // Promise that resolves successful with itemInfo (see onIAPBuyItem) or rejects unsuccessfully. Game Service Delegates onGameCenterLogin: function () // Called when Game Service Login is triggered. Return a promise. If resolve is called, Platform Connected will be set to true. onGameCenterPostScore: function (score, leaderboard) // No promise, just do what you will with the score and leaderboard name. onGameCenterShowAchievements: function () // Called when the Show Achievements action is triggered. onGameCenterResetAchievements: function () // Called when the Reset Achievements action is triggered. onGameCenterUpdateAchievement: function (identifier, percentageComplete) // Called when Update Achievement is called. onGameCenterShowLeaderboard: function (identifier) // Called when Show Leaderboard action is triggered. Data Loading Delegates onSaveTable: function(key, table, defaultFunction) { // Intercept save table events. If your delegate returns anything but undefined, the default table saving behavior will be skipped. You can use this to do things in addition to saving table data to local storage, or you can override storing the table to store the data elsewhere like a server. onSaveAttribute: function(key, value, defaultFunction) { // Intercept save attribute events. If your delegate returns anything but undefined, the default attribute saving behavior will be skipped. You can use this to do things in addition to saving attributes to local storage, or you can override storing the attribute to store the data elsewhere like a server. onLoadAttribute: function(key, defaultFunction) { // Intercept load attribute events. If your delegate returns anything but undefined, the default attribute saving behavior will be skipped. You can use this to do things in addition to saving attributes to local storage, or you can override storing the attribute to store the data elsewhere like a server. Posting Events to Engine You can also post events to the engine from inside the delegates. This will let you change attributes which can trigger events in your game logic. You will need to define this inside the gse.ready function in your index page, so you have access to the engine object. These require a bit more advanced knowledge about the internals of how some things work in the engine, so please consult a knowledgable member of our forums or our support team before using them. To post an event you will call postEvent on the engine object. engine.postEvent(event, null, param1, param) Events Include: localeDetected – param1 is the location code, param2 is the language code. Use this if you are using something other than browser information to detect a users locale information (like a call to an external API or an event from another javascript library). giveAdReward – param1 reward name, param2 reward value. Use this to update ad rewards from the results of your ad display in onCurrentSceneChanged or onShowBannerShow externalWriteGameAttribute – param1: attribute path, param2 value. Use this to update an attribute. You will need to provide the full attribute path so something like ‘game.attributes.name’ or the actual internal attribute Id for custom attributes like ‘game.attributes.id12345’. For the value you can provide a simple value like a string or number. You can also update a table (assuming your attribute is a table) by providing the complete table JSON structure (the same structure sent and received via the network behaviors). loadExternalImage – param1 imageId, param2 url. You can use this to replace an existing image in your game project with an image loaded from a URL. The imageId is the name of your image in your project. The URL is the url for the new image. If the image is already on display, call this will replace the image once it has finished loading from the network. If the URL is unable to load an image, the original image from the game project will continue to display.

Last updated on Sep 25, 2025