Members
animation
Animations for use in gameify. Usually you'll access this through the gameify object.
- Source
// 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.
// 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
// 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.
- Source
images
Image class for use in gameify. Usually you'll access this through the gameify object.
// 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
- Source
// ----------------
// 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.
// 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.
- Source
// 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.
// 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.
// 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
// 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.
// 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
| Name | Type | Description |
|---|---|---|
sel | String | The object selector ( Type::Name ) |
- Source
The object, if it exists (undefined if it doesn't)
import {$get} from './_out.js';
$get('Tilemap::Dungeon Map');addTag(tag, tilex, tiley)
Add a tag to a tile in the tileset
| Name | Type | Description |
|---|---|---|
tag | String | |
tilex | Number | |
tiley | Number |
- Source
addTag(tag, tilepos)
Add a tag to a tile in the tileset
| Name | Type | Description |
|---|---|---|
tag | String | |
tilepos | gameify. |
- Source
removeTag(tag, tilex, tiley)
Remove a tag from a tile in the tileset
| Name | Type | Description |
|---|---|---|
tag | String | |
tilex | Number | |
tiley | Number |
- Source
removeTag(tag, tilepos)
Remove a tag from a tile in the tileset
| Name | Type | Description |
|---|---|---|
tag | String | |
tilepos | gameify. |
- Source
Type Definitions
AnimationFrame
An animation frame
- Object
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
type | animationPropertyTypes | | <optional> | gameify.animation.types.simple | An animation type, or the name of an animation type |
value | any | The value of the property at the frame |
- Source
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
- Object
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
duration | Number | <optional> | 1000 | The duration of the animation, in milliseconds (calculated based on frameDuration if frameDuration is set) |
frameDuration | Number | <optional> | The duration of each frame (by default, calculated based on duration) | |
loop | Boolean | <optional> | false | If the animation should loop |
- Source
LineSegment
- Object
| Name | Type | Description |
|---|---|---|
a | gameify. | The starting point of the line segment |
b | gameify. | The ending point of the line segment |
- Source