Members

animation

Animations for use in gameify. Usually you'll access this through the gameify object.

Examples
// Use via gameify
// This is the most common way
import { gameify } from "./gameify/gameify.js"
let myAnimation = new gameify.Animation(frames, options);
// Import just sprites
import { animations } from "./gameify/animation.js"
let myAnimation = new animations.Animation(frames, options);

audio

Audio for use with gameify. Usually you'll access this through the gameify object.

Examples
// Use audio via gameify
// This is the most common way
import { gameify } from "./gameify/gameify.js"
let myScreen = new gameify.Screen(document.querySelector("#my-canvas"), 600, 400);
let mySound = new gameify.audio.Sound("my-sound.mp3");
myScreen.audio.add(mySound);
// Import just audio
import { audio } from "./gameify/audio.js"
let audioManager = new audio.AudioManager();
let mySound = new audio.Sound("my-sound.mp3");
audioManager.add(mySound);

camera

Camera for use in gameify

Example
// Use via gameify
import { gameify } from "./gameify/gameify.js"
let myScreen = new gameify.Screen(canvas, 600, 400);
myScreen.camera.translate(50, 70);

gameify

This is the main gameify object. All other things are contained within it.

images

Image class for use in gameify. Usually you'll access this through the gameify object.

Examples
// Use images via gameify
// This is the most common way
import { gameify } from "./gameify/gameify.js"
let myImage = new gameify.Image("player.png");
// Import just images
import { images } from "./gameify/image.js"
let myImage = new images.Image("player.png");

inputEventsTables

This is a mostly complete list of mouse and keyboard input events supported by gameify. Most event names are case-sensitive

Examples
// ----------------
//  Mouse Buttons
// ----------------
if (myScreen.mouse.buttonIsPressed( BUTTON_NAME )) {
    // do something
}
// Valid buttons are:
0    "left"
2    "right"
1    "middle"
// ----------------
//  Mouse Events
// ----------------
if (myScreen.mouse.eventJustHappened( EVENT_NAME )) {
    // do something
}
// Valid events are:
0    "left"
2    "right"
1    "middle"
"leave"  "mouseout"
"move"   "movemove"
"wheelup"
"wheeldown"
"wheel"
"doubleclick"
// ----------------
//  Keyboard Buttons
// ----------------
if (myScreen.keyboard.keyIsPressed( KEY_NAME )) {
    // do something
}
// Valid keys are: (On a standard US English keyboard)
// Letter keys
"A"  "KeyA"
// through
"Z"  "KeyZ"

// Other keys
"Backquote"  "Minus"  "Equal"  "BracketLeft"
"BracketRight"  "Backslash"  "Semicolon"  "Quote"
"Period"  "Comma"  "Slash"

// Numbers
"0"  "Digit0"  "Numpad0"
// through
"9"  "Digit9"  "Numpad9"
// You can check if a key is upper or lowercase by checking for the Shift key

// Arrow keys
"Up"     "ArrowUp"
"Down"   "ArrowDown"
"Left"   "ArrowLeft"
"Right"  "ArrowRight"

// Special keys
"Shift"      "ShiftLeft"     "ShiftRight"
"Control"    "ControlLeft"   "ControlRight"
"Alt"        "AltLeft"       "AltRight"
"OS"         "OSLeft"        "OSRight"
"Enter"  "NumpadEnter"   "Backspace" "CapsLock"
"Tab"    "PageUp"        "PageDown"  "Home"
"End"    "Delete"        "Insert"

// Function keys
"F1"
// through
"F15" // most keyboards only have F1-F12

// Numpad keys
"NumpadDivide"   "NumpadMultiply"  "NumpadSubtract"
"NumpadAdd"      "NumpadDecimal"

scenes

Scene class for use in gameify. Usually you'll access this through the gameify object.

Examples
// Use scenes via gameify
// This is the most common way
import { gameify } from "./gameify/gameify.js"
let mainScene = new gameify.Scene(myScreen);
// Import just scenes
import { scenes } from "./gameify/scene.js"
let myScene = new scenes.Scene(0, 0);

shapes

Shapes and collision detection for use in gameify. Usually you'll access this through the gameify object.

Examples
// Use shapes via gameify
// This is the most common way
import { gameify } from "./gameify/gameify.js"
let myCircle = new gameify.shapes.Circle(0, 0, 5);
// Import just shapes
import { shapes } from "./gameify/collision.js"
let myCircle = new shapes.Circle(0, 0, 5);

sprites

Sprite class for use in gameify. Usually you'll access this through the gameify object.

Examples
// Use sprites via gameify
// This is the most common way
import { gameify } from "./gameify/gameify.js"
let playerSprite = new gameify.Sprite(0, 0, "player.png");
// Import just sprites
import { sprites } from "./gameify/sprite.js"
let playerSprite = new sprites.Sprite(0, 0);

text

Text for use in gameify. Usually you'll access these through the gameify object.

Examples
// Use text via gameify
// This is the most common way
import { gameify } from "./gameify/gameify.js"
let myText = new gameify.Text("Hello, World!", 0, 0);
// Import just text
import { text } from "./gameify/text.js"
let myText = new text.Text("Hello, World!", 0, 0);

ui

User interfaces elements for use in Gameify

Source
Examples
// Use ui via gameify
// This is the most common way
import { gameify } from "./gameify/gameify.js"
let myButton = new gameify.ui.Button("Hello, World!", 0, 0);
// Import just ui
import { ui } from "./gameify/ui.js"
let myButton = new ui.Button("Hello, World!", 0, 0);

vectors

Vectors for use in gameify. Usually you'll access these through the gameify object.

Examples
// Use vectors via gameify
// This is the most common way
import { gameify } from "./gameify/gameify.js"
let myVector = new gameify.Vector2d(0, 0);
// Import just vectors
import { vectors } from "./gameify/vectors.js"
let myVector = new vectors.Vector2d(0, 0);

Methods

$get(sel)

Access engine objects in your code

Parameters:
NameTypeDescription
selString

The object selector ( Type::Name )

Returns:

The object, if it exists (undefined if it doesn't)

Example
import {$get} from './_out.js';
$get('Tilemap::Dungeon Map');

addTag(tag, tilex, tiley)

Add a tag to a tile in the tileset

Parameters:
NameTypeDescription
tagString
tilexNumber
tileyNumber

addTag(tag, tilepos)

Add a tag to a tile in the tileset

Parameters:
NameTypeDescription
tagString
tileposgameify.Vector2d

removeTag(tag, tilex, tiley)

Remove a tag from a tile in the tileset

Parameters:
NameTypeDescription
tagString
tilexNumber
tileyNumber

removeTag(tag, tilepos)

Remove a tag from a tile in the tileset

Parameters:
NameTypeDescription
tagString
tileposgameify.Vector2d

Type Definitions

AnimationFrame

An animation frame

Type:
  • Object
Properties
NameTypeAttributesDefaultDescription
typeanimationPropertyTypes | string<optional>
gameify.animation.types.simple

An animation type, or the name of an animation type

valueany

The value of the property at the frame

Example
const frames = [{
    image: { type: 'Image', value: new gameify.Image("player_idle1.png") },
    position: { type: 'Vector2d', value: new gameify.Vector2d(0, 2) },
},{
    image: { type: 'Image', value: new gameify.Image("player_idle2.png") },
    position: { type: 'Vector2d', value: new gameify.Vector2d(0, 2) },
},{
    image: { type: 'Image', value: new gameify.Image("player_idle3.png") },
    position: { type: 'Vector2d', value: new gameify.Vector2d(0, -2) },
},{
    image: { type: 'Image', value: new gameify.Image("player_idle4.png") },
    position: { type: 'Vector2d', value: new gameify.Vector2d(0, -2) },
}];
let myAnimation = new gameify.Animation(frames, { duration: 200, loop: true });

AnimationOptions

Animation options

Type:
  • Object
Properties
NameTypeAttributesDefaultDescription
durationNumber<optional>
1000

The duration of the animation, in milliseconds (calculated based on frameDuration if frameDuration is set)

frameDurationNumber<optional>

The duration of each frame (by default, calculated based on duration)

loopBoolean<optional>
false

If the animation should loop

LineSegment

Type:
  • Object
Properties
NameTypeDescription
agameify.Vector2d

The starting point of the line segment

bgameify.Vector2d

The ending point of the line segment