@knopkem/little-game-engine-ts
Version:
LittleGameEngineTS - Tiny and Fast HTML5 Game Engine typescript port of LittleJS
96 lines (95 loc) • 3.8 kB
TypeScript
/**
* LittleJS Medal System
* <br> - Tracks and displays medals
* <br> - Saves medals to local storage
* <br> - Newgrounds and OS13k integration
* @namespace Medals
*/
/** List of all medals
* @memberof Medals */
export declare const medals: any;
/** Set to stop medals from being unlockable (like if cheats are enabled)
* @memberof Medals */
export declare let medalsPreventUnlock: boolean;
/** This can used to enable Newgrounds functionality
* @type {Newgrounds}
* @memberof Medals */
export declare let newgrounds: any;
/** Initialize medals with a save name used for storage
* <br> - Checks if medals are unlocked
* <br> - Call this after creating all medals
* @param {String} saveName
* @memberof Medals */
export declare function medalsInit(saveName: any): void;
/** Medal Object - Tracks an unlockable medal */
export declare class Medal {
description: any;
icon: any;
id: any;
image: any;
name: any;
unlocked: any;
/**
* Create an medal object and adds it to the list of medals
* @param {Number} id - The unique identifier of the medal
* @param {String} name - Name of the medal
* @param {String} [description] - Description of the medal
* @param {String} [icon='🏆'] - Icon for the medal
* @param {String} [src] - Image location for the medal
*/
constructor(id: any, name: any, description: string | undefined, icon: string | undefined, src: any);
/** Unlocks a medal if not already unlocked */
unlock(): void;
/** Render a medal
* @param {Number} [hidePercent=0] - How much to slide the medal off screen
*/
render(hidePercent?: number): void;
/** Render the icon for a medal
* @param {Number} x - Screen space X position
* @param {Number} y - Screen space Y position
* @param {Number} [size=medalDisplayIconSize] - Screen space size
*/
renderIcon(x: any, y: any, size?: number): void;
storageKey(): string;
}
export declare function medalsRender(): void;
/** Newgrounds API wrapper object */
export declare class Newgrounds {
app_id: any;
cipher: any;
host: any;
medals: any;
scoreboards: any;
session_id: any;
/**
* Create a newgrounds object
* @param {Number} app_id - The newgrounds App ID
* @param {String} [cipher] - The encryption Key (AES-128/Base64)
*/
constructor(app_id: any, cipher: any);
/** Send message to unlock a medal by id
* @param {Number} id - The medal id */
unlockMedal(id: any): any;
/** Send message to post score
* @param {Number} id - The scoreboard id
* @param {Number} value - The score value */
postScore(id: any, value: any): any;
/** Send message to log a view */
logView(): any;
/** Get scores from a scoreboard
* @param {Number} id - The scoreboard id
* @param {String} [user=0] - A user's id or name
* @param {Number} [social=0] - If true, only social scores will be loaded
* @param {Number} [skip=0] - Number of scores to skip before start
* @param {Number} [limit=10] - Number of scores to include in the list
* @return {Object} - The response JSON object
*/
getScores(id: any, user?: number, social?: number, skip?: number, limit?: number): any;
/** Send a message to call a component of the Newgrounds API
* @param {String} component - Name of the component
* @param {Object} [parameters=0] - Parameters to use for call
* @param {Boolean} [async=0] - If true, wait for response before continuing (will cause stall)
* @return {Object} - The response JSON object
*/
call(component: any, parameters?: number, async?: number): any;
}