Core

Core

MDog is the object you get when you import MDog Engine. It runs the game loop, and holds every module.

import MDog from "https://cdn.jsdelivr.net/gh/MiloKesteloot/MDogEngine@v1.4.0/MDogModules/MDogMain.js";

The Game Loop

A game's main code goes in one function, called the "active function." MDog Engine runs the active function 160 times per second, and each run is a "tick." Ticks happen at the same speed no matter how fast the player's screen refreshes, so a game can move things by a set amount every tick, instead of working out how much time has passed.

After the ticks for a frame are done, every layer is drawn to the screen.

If the game falls more than 100 ticks behind, like when the browser tab was hidden, the missed ticks are skipped instead of all running at once.

Core Methods

Properties

Property Description
ticksPerSecond How many times per second the active function runs. Defaults to 160.

Modules

Module Description
MDog.Draw Shapes, images, pixel font text, animations, and layers.
MDog.Input The keyboard and mouse.
MDog.Math Math helpers, and 2D and 3D vectors (Vector and Vector3).
MDog.UI Pages, tilemaps, and grids.
MDog.FX Particles.
MDog.ThreeDee Retro pseudo-3D scenes.
MDog.AssetManager Loading text files.
MDog.Basics Hitboxes.