Code edit (2 edits merged)
Please save this source code
User prompt
in the on tick event, iterate through all the particles in the particleList calling their update function, if it returns true, then destroy and remove the particle from the array
Code edit (2 edits merged)
Please save this source code
User prompt
When clicking in the game, create a new HammerParticle at the click position, and add it to a new particleList array
User prompt
Instead of using delta time, use ticks
User prompt
Convert the delta time to ticks
User prompt
The HammerParticle scaling and fading should be performed in a new update function, and should be performed over time
User prompt
Rename ImpactParticle to HammerParticle
User prompt
Create a new ImpactParticle class that inherits from the ConfigContainer. The class has an asset randomized from hammerParticle1-5, has a slightly random rotation, and grows to 1.5x scale over 100ms, then fades (to 0 opacity) and shrinks (to 0x scale) over 500ms.
User prompt
Rename all trollLeader
User prompt
Add a new LeaderTroll1 class that inherits from the Leader class
User prompt
Add a new Leader class that inherits from ConfigContainer
Code edit (1 edits merged)
Please save this source code
User prompt
Please remove the width and height of the hole Containers, they should only act as points
User prompt
After creating a tableSlice asset, also create a number of empty Containers based on the value of the current TABLE_HOLES index, these should be positioned at the current y values, and evenly centered along the x position with a gap between each of TABLE_HOLE_GAP
Code edit (1 edits merged)
Please save this source code
User prompt
Instead of a forEach iterating through an array of tableSlice assets, use a for-loop with a max bound of TABLE_SLICES, and construct the asset name from the for loop's index
Code edit (2 edits merged)
Please save this source code
User prompt
Update the tableCut asset names in the Table class
User prompt
Rename all tableCut
Code edit (1 edits merged)
Please save this source code
User prompt
create a new table instance in the center of the screen with a width of 2400. Place the new instance code between the two semi-colons under the "Global variables" heading
User prompt
The config object in Table takes in a width. Each tableCut asset should have their width set to the config width, and have their height scaled relatively
User prompt
Add a new Table class that extends ConfigContainer, taking in a config object. The class is comprised of all 6 tableCut assets (each with origin of 0.5,0), starting from 1 at 0,0 origin and placing each new asset below the other.
Code edit (1 edits merged)
Please save this source code
/****
* Classes
****/
/**
* config {
* x : Number || 0,
* y : Number || 0,
* rotation : Number || 0,
* }
**/
var ConfigContainer = Container.expand(function (config) {
var self = Container.call(this);
config = config || {};
;
self.x = config.x || 0;
self.y = config.y || 0;
self.rotation = config.rotation || 0;
;
return self;
});
var Textbox = ConfigContainer.expand(function (message, config) {
var self = ConfigContainer.call(this, config);
config = config || {};
;
var background = self.addChild(new BorderedShape({
width: config.width,
height: config.height,
weight: 10,
anchorY: 1
}));
var textboxTail = self.attachAsset('textboxTail', {
y: 1,
x: 20,
tint: 0xbbbabe
});
var logo = self.addChild(new BorderedSymbol('logo', {
x: -20,
y: 20,
anchorX: 0,
anchorY: 1,
height: config.height + 40
}));
var typedText = self.addChild(new TypedText(message, {
x: logo.width,
y: -config.height / 2,
anchorY: 0.5,
delay: 50
}));
;
return self;
});
/**
* config {
* x : Number || 0, // See: ConfigContainer
* y : Number || 0, // See: ConfigContainer
* rotation : Number || 0, // See: ConfigContainer
* anchorX : Number || 0,
* anchorY : Number || 1,
* size : Number || TEXT_DEFAULT_SIZE,
* weight : Number || TEXT_DEFAULT_WEIGHT,
* font : String || TEXT_DEFAULT_FONT,
* fill : String || TEXT_DEFAULT_FILL,
* border : String || TEXT_DEFAULT_BORDER,
* }
**/
var BorderedText = ConfigContainer.expand(function (text, config) {
var self = ConfigContainer.call(this, config);
config = config || {};
;
var anchorX = config.anchorX !== undefined ? config.anchorX : 0;
var anchorY = config.anchorY !== undefined ? config.anchorY : 1;
var size = config.size !== undefined ? config.size : TEXT_DEFAULT_SIZE;
var weight = config.weight !== undefined ? config.weight : TEXT_DEFAULT_WEIGHT;
var font = config.font !== undefined ? config.font : TEXT_DEFAULT_FONT;
var textFill = config.fill !== undefined ? config.fill : TEXT_DEFAULT_FILL;
var borderFill = config.border !== undefined ? config.border : TEXT_DEFAULT_BORDER;
var textAssets = [];
var mainAsset;
;
self.setText = setText;
self.setFill = setFill;
;
function setText(newText) {
for (var i = 0; i < textAssets.length; i++) {
textAssets[i].setText(newText);
}
}
function setFill(newFill) {
textFill = newFill;
mainAsset.fill = newFill;
}
function buildTextAssets(newText) {
for (var i = 0; i < TEXT_OFFSETS.length; i++) {
var main = i === TEXT_OFFSETS.length - 1;
var fill = main ? textFill : borderFill;
var textAsset = textAssets[i];
if (textAsset) {
textAsset.destroy();
}
textAsset = self.addChild(new Text2(newText, {
fill: fill,
font: font,
size: size
}));
textAsset.anchor = {
x: anchorX,
y: anchorY
}; // NOTE: Cannot be set in config
textAsset.x = TEXT_OFFSETS[i][0] * weight; // NOTE: Cannot be set in config
textAsset.y = TEXT_OFFSETS[i][1] * weight; // NOTE: Cannot be set in config
textAssets[i] = textAsset;
}
mainAsset = textAssets[TEXT_OFFSETS.length - 1];
}
;
buildTextAssets(text);
return self;
});
var TypedText = BorderedText.expand(function (text, config) {
var self = BorderedText.call(this, text, config);
var baseSetText = self.setText;
config = config || {};
;
var counter = 0;
var delay = config.delay;
var interval;
;
self.setText = setText;
self.completed = false;
;
function setText(newText) {
if (interval) {
LK.clearInterval(interval);
}
self.completed = false;
text = newText;
counter = 0;
interval = LK.setInterval(updateText, delay);
updateText();
}
function updateText() {
var subText = text.substr(0, ++counter).replace(/#/g, '');
baseSetText(subText);
if (counter === text.length) {
LK.clearInterval(interval);
self.completed = true;
}
}
;
setText(text);
return self;
});
/**
* var config = {
* x : Number || 0, // See: ConfigContainer
* y : Number || 0, // See: ConfigContainer
* rotation : Number || 0, // See: ConfigContainer
* anchorX : Number || .5,
* anchorY : Number || .5,
* scale : Number || undefined,
* scaleX : Number || scale,
* scaleY : Number || scale,
* weight : Number || TEXT_DEFAULT_WEIGHT,
* width : Number || undefined, // Auto-calculated if left undefined and height is set
* height : Number || undefined, // Auto-calculated if left undefined and width is set
* tint : String || 0xFFFFFF, // Not tinted by default
* border : String || TEXT_DEFAULT_BORDER,
* }
**/
var BorderedSymbol = ConfigContainer.expand(function (symbol, config) {
var self = ConfigContainer.call(this, config);
config = config || {};
var width = config.width !== undefined ? config.width : undefined;
var height = config.height !== undefined ? config.height : undefined;
var scale = config.scale !== undefined ? config.scale : undefined;
var scaleX = config.scaleX !== undefined ? config.scaleX : scale;
var scaleY = config.scaleY !== undefined ? config.scaleX : scale;
var weight = config.weight !== undefined ? config.weight : TEXT_DEFAULT_WEIGHT;
var anchorX = config.anchorX !== undefined ? config.anchorX : .5;
var anchorY = config.anchorY !== undefined ? config.anchorY : .5;
var symbolTint = config.tint !== undefined ? config.tint : 0xFFFFFF;
var borderTint = config.border !== undefined ? config.border : TEXT_DEFAULT_BORDER;
var mainSymbol;
var symbolAssets = [];
;
self.setSymbol = buildSymbolAssets;
self.setTint = setTint;
;
function setTint(newTint) {
// NOTE: Tinting is currently broken (cannot use string)
// mainSymbol.tint = newTint;
// symbolConfig.tint = newTint
}
function buildSymbolAssets(newSymbol) {
for (var i = 0; i < TEXT_OFFSETS.length; i++) {
var main = i === TEXT_OFFSETS.length - 1;
var symbolAsset = symbolAssets[i];
if (symbolAsset) {
symbolAsset.destroy();
}
symbolAsset = self.attachAsset(newSymbol, {
// tint: main ? symbolTint : borderTint,
tint: main ? 0xFFFFFF : 0x000000,
// NOTE: Tinting is currently broken (cannot use string)
x: TEXT_OFFSETS[i][0] * weight,
y: TEXT_OFFSETS[i][1] * weight,
anchorX: anchorX,
anchorY: anchorY
});
if (width !== undefined && height === undefined) {
height = symbolAsset.height * (width / symbolAsset.width);
} else if (height !== undefined && width === undefined) {
width = symbolAsset.width * (height / symbolAsset.height);
}
symbolAsset.width = width;
symbolAsset.height = height;
if (scaleX !== undefined && scaleY !== undefined) {
symbolAsset.scale.set(scaleX, scaleY);
}
symbolAssets[i] = symbolAsset;
}
mainSymbol = symbolAssets[TEXT_OFFSETS.length - 1];
}
;
buildSymbolAssets(symbol);
return self;
});
/**
* config {
* x : Number || 0, // See: ConfigContainer
* y : Number || 0, // See: ConfigContainer
* rotation : Number || 0, // See: ConfigContainer
* anchorX : Number || 0,
* anchorY : Number || 0,
* width : Number || 100,
* height : Number || 100,
* weight : Number || TEXT_DEFAULT_WEIGHT,
* shape : String || 'square',
* fill : String || TEXT_DEFAULT_FILL,
* border : String || TEXT_DEFAULT_BORDER,
* }
**/
var BorderedShape = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
config = config || {};
;
var anchorX = config.anchorX !== undefined ? config.anchorX : 0;
var anchorY = config.anchorY !== undefined ? config.anchorY : 0;
var width = config.width !== undefined ? config.width : 100;
var height = config.height !== undefined ? config.height : 100;
var weight = config.weight !== undefined ? config.weight : TEXT_DEFAULT_WEIGHT;
var shape = config.shape !== undefined ? config.shape : 'shapeRectangle';
var frontTint = 0xFFFFFF; //hexToHex(config.fill !== undefined ? config.fill : TEXT_DEFAULT_FILL);
var borderTint = 0x000000; //hexToHex(config.border !== undefined ? config.border : TEXT_DEFAULT_BORDER);
var background = self.attachAsset(shape, {
x: weight * 2 * (anchorX - 0.5),
y: weight * 2 * (anchorY - 0.5),
tint: borderTint,
width: width + 2 * weight,
height: height + 2 * weight,
anchorX: anchorX,
anchorY: anchorY
});
var foreground = self.attachAsset(shape, {
tint: frontTint,
width: width,
height: height,
anchorX: anchorX,
anchorY: anchorY
});
;
return self;
});
/****
* Initialize Game
****/
// Assets will be automatically initialized based on usage in the code.
var game = new LK.Game({
backgroundColor: 0xD3D3D3 // Init game with light grey background
});
/****
* Game Code
****/
;
//==============================================================================
// Global constants & settings
//==============================================================================
;
// Math constants / pre-calculations
var MATH_2_PI = Math.PI * 2;
var MATH_HALF_PI = Math.PI / 2;
var MATH_QUARTER_PI = Math.PI / 4;
var MATH_HALF_ROOT_3 = Math.sqrt(3) / 2; // Required by: TEXT_OFFSETS, BorderedText, BorderedSymbol, BorderedShape, SymbolText
var MATH_APPROX_ZERO = 0.0000001;
;
// Text settings
var TEXT_OFFSETS = [[0, 1], [MATH_HALF_ROOT_3, 0.5], [MATH_HALF_ROOT_3, -0.5], [0, -1], [-MATH_HALF_ROOT_3, -0.5], [-MATH_HALF_ROOT_3, 0.5], [0, 0]]; // Required by: BorderedText, BorderedSymbol, BorderedShape, SymbolText
var TEXT_DEFAULT_WEIGHT = 6; // Required by: BorderedText, BorderedSymbol, BorderedShape, SymbolText
var TEXT_DEFAULT_BORDER = '#000000'; // Required by: BorderedText, BorderedSymbol, BorderedShape, SymbolText
var TEXT_DEFAULT_FILL = '#FFFFFF'; // Required by: BorderedText, SymbolText
var TEXT_DEFAULT_FONT = 'Arial'; // Required by: BorderedText, SymbolText
var TEXT_DEFAULT_SIZE = 50; // Required by: BorderedText, SymbolText
var TEXT_DEFAULT_MARGIN = 10; // Required by: SymbolText
;
// Game constants
var GAME_TICKS = 60;
var GAME_WIDTH = 2048;
var GAME_HEIGHT = 2732;
;
//==============================================================================
// Global variables
//==============================================================================
;
;
//==============================================================================
// Global functions
//==============================================================================
;
function hexToHex(input) {
if (typeof input === 'string') {
return parseInt(input.replace(/^#/, ''), 16);
} else if (typeof input === 'number') {
return '#' + input.toString(16).padStart(6, '0');
}
return input;
}
logo for a company called "blue lizard entertainment" using a damaged font and frozen elements.
Pixel art of the bam symbol. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of bam comic symbol.
pixel art of pow comic symbol.
pixel art of plastic squeaky hammer.
pixel art of a large, round, red start button.