This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function kill(childObj:String, parentObj:String = ""):void | |
{ | |
if (this[childObj] != null) | |
{ | |
if (stage.contains(this[childObj])) | |
{ | |
if (parentObj != "") this[parentObj].removeChild(this[childObj]); | |
else removeChild(this[childObj]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package starling.extensions { | |
import flash.events.Event; | |
import flash.media.Sound; | |
import flash.media.SoundChannel; | |
import flash.media.SoundTransform; | |
import flash.utils.Dictionary; | |
import starling.core.Starling; | |
public class SoundManager { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @func approach(target, endpoint, amount); | |
/// @description move target to endpoint by given amount | |
/// @arg target | |
/// @arg endpoint | |
/// @arg amount | |
if(argument0 < argument1) return min(argument0 + argument2, argument1); | |
else return max(argument0 - argument2, argument1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///@description Converts RGB hex color to BGR | |
///@arg color RGB hex color to be converted | |
///@returns BGR hex color | |
///@example draw_set_color(color_fix($FF0000)) | |
function color_fix(color) { | |
return ((argument0 & $FF) << 16) | (argument0 & $FF00) | ((argument0 >> 16) & $FF); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @func draw_boundbox(color) | |
/// @param color | |
/// @description Draws a rectangle around the mask_index | |
function draw_boundbox(color, outline) { | |
draw_set_color(color); | |
draw_rectangle(bbox_left, bbox_top, bbox_right, bbox_bottom, outline); | |
draw_set_color(c_white); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Calculates the diagonal length of the display in inches based on the display's width, height, and DPI values. | |
* | |
* @returns {number} The diagonal length of the display in inches. | |
*/ | |
function display_get_diagonal_inches() | |
{ | |
return sqrt(sqr(display_get_width()) + sqr(display_get_height())) / max(display_get_dpi_x(), display_get_dpi_y()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts a length in inches to the equivalent length in pixels, based on the current display's DPI. | |
* @param {number} inches - The length in inches to convert to pixels. | |
* @returns {number} The equivalent length in pixels. | |
* | |
* @author Written by Gkri (Harpwood studio) | |
* @license MIT License https://opensource.org/licenses/MIT | |
*/ | |
function display_inches_to_pixel(inches) { | |
return max(display_get_dpi_x(), display_get_dpi_y()) * inches; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///==================================== | |
/// How to use with constructor | |
///==================================== | |
/// Create event | |
/// d_mouse = new draw_debug_mouse(); | |
///----------------------------------- | |
/// Draw event to get room x,y | |
/// d_mouse.room_xy(); | |
///----------------------------------- | |
/// Draw GUI event to get GUI x,y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @description audio queue manager 0.1.0 alpha | |
/// Very early version tailored to my needs. It might get | |
/// heavy changes in the future. I might improve it in the | |
/// future. Any contribution or suggestions are welcome! | |
/// Consider each instance as a seperate audio channel | |
/// You can use more that one instance for multi-channel | |
/** @Instructions | |
* Create an empty wav file with your desired duration and name it snd_space | |
* This wav file will be used as a spacer between the sounds in the queue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts a length in centimeters to the equivalent length in pixels, based on the current display's DPI. | |
* @param {number} cm - The length in centimeters to convert to pixels. | |
* @returns {number} The equivalent length in pixels. | |
* | |
* @author Written by Gkri (Harpwood studio) | |
* @license MIT License https://opensource.org/licenses/MIT | |
*/ | |
function display_centimeters_to_pixel(cm) { | |
return max(display_get_dpi_x(), display_get_dpi_y()) * cm / 2.54; |
OlderNewer