Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: setTimeout is not a function' in or related to this line: 'attackTimeout = setTimeout(function () {' Line Number: 401
Code edit (3 edits merged)
Please save this source code
User prompt
play throwsnd when player_throw is instantiated
User prompt
Please fix the bug: 'Uncaught TypeError: setTimeout is not a function' in or related to this line: 'attackTimeout = setTimeout(function () {' Line Number: 396
Code edit (1 edits merged)
Please save this source code
User prompt
make player_throw move faster
User prompt
cloudsmoke alpha to 75%
User prompt
0.5 seconds instead of 0.1
User prompt
make a tween out of cloudsmoke, add a pop and a disappear after 0.1 seconds ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
add 50% transparency to cloud smoke
User prompt
cloudsmoke should instantiate where player_throw appears which is next to the player_idle, why is it not working? fix it
User prompt
instantiate cloudsmoke where player_throw is created
User prompt
instantiate flash where player_throw is instantiated
User prompt
instantiate with a 50% transparency flash where player_throw is instantiated
Code edit (1 edits merged)
Please save this source code
User prompt
when enemy is killed with player_attackf02 , give 2 points instead of 1, when instead enemy is killed with player_throw, give 1 point
User prompt
when enemy is killed with playerfattack, give 2 points instead of 1
User prompt
In spawnProjectile function, right after calculating the projectile's velocity, add: proj.scaleX = (targetX < player.x) ? -1 : 1;
Code edit (1 edits merged)
Please save this source code
User prompt
Create a function to track when a press is being held. This is typically done by setting up event listeners for the `down` and `up` events. When the `down` event is triggered, you can start a timer or set a flag indicating that the press is being held. You can then check the duration of the hold or perform actions while the press is held. When the `up` event is triggered, you can stop the timer or reset the flag, indicating that the press is no longer being held. This allows you to implement features like dashing, where an action is triggered after holding a press for a certain duration.
User prompt
When the player slashes left, the idle should be inverted
User prompt
When the player jumps, flip the jumping asset randomly so it's not always the same thing
User prompt
trigger a game over when the enemy touches the player and the player is neither jumping or attacking
Code edit (1 edits merged)
Please save this source code
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Shape = Container.expand(function (options) { var self = Container.call(this); self.attachAsset('shape', { width: options.width, height: options.height, anchorX: options.anchorX || 0, anchorY: options.anchorY || 0, color: options.color || 0x66ff00, alpha: typeof options.alpha === 'number' ? options.alpha : 0 // invisible shape }); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ /**** * Global Variables ****/ // For the jump collider var jumpColGlobal = null; // For projectile input tracking var isPressHeld = false; var pressHoldStartTime = 0; var pressDownX = 0; var pressDownY = 0; var attackTimeout = null; // To delay melee attack /**** * Score Setup ****/ var score = 0; var scoreTxt; // container for the score text function updateScoreDisplay() { game.removeChild(scoreTxt); scoreTxt = createScoreText(score); scoreTxt.scaleX = 1.0; scoreTxt.scaleY = 1.0; game.addChild(scoreTxt); tween(scoreTxt, { scaleX: 1.5, scaleY: 1.5 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(scoreTxt, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeIn }); } }); } function incrementScore() { score++; updateScoreDisplay(); } function createScoreText(value) { var shadow = new Text2(String(value), { size: 600, fill: 0x000000, fontFamily: "Arial" }); shadow.name = "shadow"; shadow.anchor.set(0.5, 0); shadow.x = 4; shadow.y = 4; var main = new Text2(String(value), { size: 600, fill: 0xFF69B4, fontFamily: "Arial" }); main.name = "main"; main.anchor.set(0.5, 0); var container = new Container(); container.name = "scoreTxt"; container.x = 1024; container.y = 50; container.addChild(shadow); container.addChild(main); return container; } scoreTxt = createScoreText(score); scoreTxt.scaleX = 1.0; scoreTxt.scaleY = 1.0; LK.playMusic('bgm', { loop: true }); var bg01 = LK.getAsset('bg01', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 }); game.addChild(bg01); game.addChild(scoreTxt); /**** * Petals ****/ var petals = []; for (var i = 0; i < 50; i++) { var petal = new Container(); petal.attachAsset('petals', { anchorX: 0.5, anchorY: 0.5, rotation: Math.random() * Math.PI * 2 }); petal.x = Math.random() * 2048; petal.y = Math.random() * 2732; petal.speedY = Math.random() * 2 + 1; petal.speedX = Math.random() * 2 - 1; petal.update = function () { this.y += this.speedY; this.x += this.speedX; if (this.y > 2732) { this.y = -50; this.x = Math.random() * 2048; } }; petals.push(petal); game.addChild(petal); } /**** * Player Setup ****/ var player = new Container(); var visualContainer = new Container(); visualContainer.name = 'visual'; var playerSprite = visualContainer.attachAsset('player_idle', { anchorX: 0.5, anchorY: 0.5 }); player.addChild(visualContainer); player.x = 1024; player.y = 2732 - 250; game.addChild(player); /**** * Idle Animations ****/ function startBreathingAnimation() { tween(player, { scaleX: 1.05, scaleY: 1.05 }, { duration: 1000, easing: tween.easeInOut, onFinish: function onFinish() { tween(player, { scaleX: 1.0, scaleY: 1.0 }, { duration: 1000, easing: tween.easeInOut, onFinish: startBreathingAnimation }); } }); } function startTiltAnimation() { tween(player, { rotation: Math.PI / 32 }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { tween(player, { rotation: -Math.PI / 32 }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { tween(player, { rotation: 0 }, { duration: 500, easing: tween.easeInOut, onFinish: startTiltAnimation }); } }); } }); } startBreathingAnimation(); startTiltAnimation(); /**** * Attack Collider ****/ var attackCol = LK.getAsset('attackcol', { anchorX: 0.5, anchorY: 0.5, alpha: 0.75 }); game.addChild(attackCol); attackCol.visible = false; attackCol.alpha = 0; /**** * Swap Player Sprite ****/ function swapPlayerVisual(newVisualId, x, y) { var flip = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; var onDone = arguments.length > 4 ? arguments[4] : undefined; var visualContainer = player.findChildByName('visual'); if (!visualContainer) { visualContainer = new Container(); visualContainer.name = 'visual'; player.addChild(visualContainer); } else { visualContainer.removeChildAt(0); } playerSprite = visualContainer.attachAsset(newVisualId, { anchorX: 0.5, anchorY: 0.5 }); visualContainer.scaleX = flip; player.x = x; player.y = y; if (newVisualId === 'player_jump') { flip = Math.random() < 0.5 ? -1 : 1; visualContainer.scaleX = flip; jumpColGlobal = LK.getAsset('jumpcol', { anchorX: 0.5, anchorY: 0.5, x: x, y: y + player.height / 2, alpha: 0 }); game.addChild(jumpColGlobal); tween(jumpColGlobal, { y: jumpColGlobal.y - 600 }, { duration: 500, easing: tween.easeOut, onFinish: function onFinish() { tween(jumpColGlobal, { y: 2732 - 250 + player.height / 2 }, { duration: 300, easing: tween.bounceOut, onFinish: function onFinish() { jumpColGlobal.destroy(); jumpColGlobal = null; } }); } }); } if (typeof onDone === 'function') { if (newVisualId === 'player_idle') { startBreathingAnimation(); startTiltAnimation(); } onDone(); } } /**** * Input Logic * Prevent melee attacks while jumping—but allow projectile throws. ****/ var isSequenceRunning = false; var isJumping = false; var playerState = 'idle'; game.down = function (x, y) { if (isSequenceRunning) { return; } isPressHeld = true; pressHoldStartTime = Date.now(); pressDownX = x; pressDownY = y; // Jump if tapped in top 2/3 and not already jumping. if (y < 2732 * 2 / 3 && !isJumping) { isJumping = true; LK.getSound('hup').play(); swapPlayerVisual('player_jump', player.x, player.y); // Dust effect for jump. for (var i = 0; i < 10; i++) { var p = LK.getAsset('dust', { anchorX: 0.5, anchorY: 0.5, x: player.x + (Math.random() * 100 - 50), y: player.y + (Math.random() * 100 - 50) }); game.addChild(p); tween(p, { alpha: 0, x: p.x + (Math.random() * 200 - 100), y: p.y - Math.random() * 200 }, { duration: 500, onFinish: function onFinish() { p.destroy(); } }); } tween(player, { y: player.y - 600 }, { duration: 500, easing: tween.easeOut, onFinish: function onFinish() { tween(player, { y: 2732 - 250 }, { duration: 300, easing: tween.bounceOut, onFinish: function onFinish() { for (var j = 0; j < 10; j++) { var pp = LK.getAsset('dust', { anchorX: 0.5, anchorY: 0.5, x: player.x + (Math.random() * 100 - 50), y: player.y + (Math.random() * 100 - 50) }); game.addChild(pp); tween(pp, { alpha: 0, x: pp.x + (Math.random() * 200 - 100), y: pp.y + Math.random() * 200 }, { duration: 500, onFinish: function onFinish() { pp.destroy(); } }); } isJumping = false; swapPlayerVisual('player_idle', 1024, 2732 - 250, 1, function () { startBreathingAnimation(); startTiltAnimation(); }); var v = player.findChildByName('visual'); if (v) { var dir = v.scaleX < 0 ? -1 : 1; tween(v, { scaleX: dir * 1.3, scaleY: 1.3 }, { duration: 50, onFinish: function onFinish() { tween(v, { scaleX: dir * 1.0, scaleY: 1.0 }, { duration: 100 }); } }); } } }); } }); // If jumping, do not schedule melee attack. return; } // If player is already jumping, do not schedule a melee attack. if (isJumping) { return; } // Attack if tapped in bottom 1/3 (non-jumping case) isSequenceRunning = true; var flip = x < 1024 ? -1 : 1; swapPlayerVisual('player_attackf01', 1024, 2732 - 250, flip); LK.getSound('retroslash').play(); var vis = player.findChildByName('visual'); if (vis) { tween(vis, { scaleX: flip * 1.3, scaleY: 1.3 }, { duration: 50, onFinish: function onFinish() { tween(vis, { scaleX: flip * 1.0, scaleY: 1.0 }, { duration: 100 }); } }); } attackTimeout = setTimeout(function () { if (isPressHeld) { isSequenceRunning = true; var flip = x < 1024 ? -1 : 1; swapPlayerVisual('player_attackf02', 1024, 2732 - 250, flip); attackCol.width = 180; attackCol.height = 180; attackCol.x = flip === -1 ? 874 : 1174; attackCol.y = 2732 - 250; attackCol.scaleX = flip; attackCol.visible = true; LK.setTimeout(function () { if (attackCol) { attackCol.visible = false; } swapPlayerVisual('player_idle', 1024, 2732 - 250, 1, function () { startBreathingAnimation(); startTiltAnimation(); }); isSequenceRunning = false; playerState = 'idle'; }, 250); } }, 250); }; /**** * game.up: Reset press info. ****/ game.up = function (x, y) { if (isPressHeld) { var holdDuration = Date.now() - pressHoldStartTime; if (holdDuration > 500 && attackTimeout) { clearTimeout(attackTimeout); attackTimeout = null; } } isPressHeld = false; pressHoldStartTime = 0; }; /**** * Enemies Array + Spawn ****/ var enemies = []; function spawnEnemy() { var e = new Container(); var hitbox = new Shape({ width: 200, height: 209, anchorX: 0.5, anchorY: 0.5, color: 0x00FF00, alpha: 0 }); hitbox.x = 0; hitbox.y = 0; e.addChild(hitbox); var gfx = e.attachAsset('enemy01', { anchorX: 0.5, anchorY: 0.5 }); var fromLeft = Math.random() < 0.5; e.x = fromLeft ? -gfx.width / 2 : 2048 + gfx.width / 2; e.y = 2732 - 225; e.speedX = fromLeft ? Math.random() * 4 + 2 : -(Math.random() * 4 + 2); gfx.scaleX = fromLeft ? 1 : -1; var baseY = e.y; function bounce() { tween(e, { y: baseY - 50 }, { duration: 500, easing: tween.bounceInOut, onFinish: function onFinish() { tween(e, { y: baseY }, { duration: 500, easing: tween.bounceInOut, onFinish: bounce }); } }); } bounce(); enemies.push(e); game.addChild(e); } LK.setInterval(spawnEnemy, Math.random() * 1500 + 1000); /**** * NEW CODE: Projectile Logic * Modified for jumping so projectiles spawn from a lower point and aim downward. ****/ var projectiles = []; function spawnProjectile(targetX, targetY) { var proj = new Container(); proj.attachAsset('player_throw', { anchorX: 0.5, anchorY: 0.5 }); LK.getSound('throwsnd').play(); // Determine the spawn position. var spawnX = player.x; var spawnY = player.y; // If the player is jumping, adjust spawnY to be near the bottom of the player // and force the targetY to be downward. if (isJumping) { spawnY = player.y + 100; // Adjust as needed. targetY = spawnY + 200; // Force downward. } proj.x = spawnX; proj.y = spawnY; // Calculate direction vector from spawn position to target. var dx = targetX - spawnX; var dy = targetY - spawnY; var dist = Math.sqrt(dx * dx + dy * dy); if (dist !== 0) { dx /= dist; dy /= dist; } var speed = 25; proj.vx = dx * speed; proj.vy = dy * speed; // Adjust scaleX based on target relative to player. proj.scaleX = targetX < player.x ? -1 : 1; proj.distanceTraveled = 0; proj.maxDistance = 1000; projectiles.push(proj); game.addChild(proj); } /**** * Main Update ****/ game.update = function () { // Check hold duration for long press projectile. if (isPressHeld) { var holdDuration = Date.now() - pressHoldStartTime; if (holdDuration > 500) { console.log("Long press detected, spawn projectile!"); isPressHeld = false; spawnProjectile(pressDownX, pressDownY); } } // Update projectiles. for (var p = projectiles.length - 1; p >= 0; p--) { var proj = projectiles[p]; proj.x += proj.vx; proj.y += proj.vy; var stepDist = Math.sqrt(proj.vx * proj.vx + proj.vy * proj.vy); proj.distanceTraveled += stepDist; if (proj.distanceTraveled > proj.maxDistance) { projectiles.splice(p, 1); proj.destroy(); continue; } if (proj.x < -100 || proj.x > 2148 || proj.y < -100 || proj.y > 2832) { projectiles.splice(p, 1); proj.destroy(); continue; } // Check collision with enemies. for (var ei = enemies.length - 1; ei >= 0; ei--) { var enemy = enemies[ei]; if (proj.intersects(enemy)) { // Use 'throw' attack type for projectiles. handleEnemyHit(enemy, ei, 'throw'); projectiles.splice(p, 1); proj.destroy(); break; } } } // Update enemies. for (var i = enemies.length - 1; i >= 0; i--) { var e = enemies[i]; e.x += e.speedX; if (e.x < -300 || e.x > 2048 + 300) { var index = enemies.indexOf(e); if (index !== -1) { enemies.splice(index, 1); } e.destroy(); continue; } // Check collision with jump collider. if (jumpColGlobal && jumpColGlobal.visible && e.intersects(jumpColGlobal)) { handleEnemyJumpHit(e, i); continue; } // Check collisions with melee attack collider. if (attackCol.visible && e.intersects(attackCol)) { handleEnemyHit(e, i, 'melee'); } // Check if enemy intersects with player (game over). if (!isJumping && !attackCol.visible && e.intersects(player)) { LK.showGameOver(); } } }; /**** * Enemy Hit Logic (Melee or Throw) ****/ function handleEnemyHit(enemy, index, attackType) { if (!enemies.includes(enemy)) { return; } LK.getSound('slimedeath').play(); if (enemy.bounceTween && typeof enemy.bounceTween.cancel === 'function') { enemy.bounceTween.cancel(); } tween(enemy, { tint: 0xFF0000 }, { duration: 0, onFinish: function onFinish() { tween(enemy, { scaleX: 1.3, scaleY: 1.3 }, { duration: 50, onFinish: function onFinish() { tween(enemy, { scaleX: 0.5, scaleY: 0.5, alpha: 0 }, { duration: 100, onFinish: function onFinish() { var idx = enemies.indexOf(enemy); if (idx !== -1) { enemies.splice(idx, 1); } enemy.destroy(); if (!enemy.scoreCounted) { if (attackType === 'melee') { score += 2; } else if (attackType === 'throw') { score += 1; } else { score++; } updateScoreDisplay(); enemy.scoreCounted = true; } } }); } }); } }); } /**** * Enemy Hit Logic for Jump Collider ****/ function handleEnemyJumpHit(enemy, index) { if (!enemies.includes(enemy)) { return; } LK.getSound('boing').play(); if (enemy.bounceTween && typeof enemy.bounceTween.cancel === 'function') { enemy.bounceTween.cancel(); } tween(enemy, { tint: 0xFF0000 }, { duration: 0, onFinish: function onFinish() { var targetX = enemy.x < 1024 ? -300 : 2048 + 300; var targetY = enemy.y - 600; tween(enemy, { x: targetX, y: targetY, alpha: 0 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { var idx = enemies.indexOf(enemy); if (idx !== -1) { enemies.splice(idx, 1); } enemy.destroy(); if (!enemy.scoreCounted) { score += 3; updateScoreDisplay(); enemy.scoreCounted = true; } } }); } }); } /**** * findChildByName Helper ****/ Container.prototype.findChildByName = function (name) { for (var i = 0; i < this.children.length; i++) { if (this.children[i].name === name) { return this.children[i]; } } return null; }; /**** * game.up: Reset Press Info ****/ game.up = function (x, y) { isPressHeld = false; pressHoldStartTime = 0; };
===================================================================
--- original.js
+++ change.js
@@ -5,9 +5,8 @@
/****
* Classes
****/
-// Basic Shape class (so "Shape" is defined)
var Shape = Container.expand(function (options) {
var self = Container.call(this);
self.attachAsset('shape', {
width: options.width,
@@ -46,16 +45,13 @@
****/
var score = 0;
var scoreTxt; // container for the score text
function updateScoreDisplay() {
- // Remove the old scoreTxt from the game
game.removeChild(scoreTxt);
- // Create a new score container with the updated score
scoreTxt = createScoreText(score);
scoreTxt.scaleX = 1.0;
scoreTxt.scaleY = 1.0;
game.addChild(scoreTxt);
- // Add tween animation to score display
tween(scoreTxt, {
scaleX: 1.5,
scaleY: 1.5
}, {
@@ -100,9 +96,8 @@
container.addChild(shadow);
container.addChild(main);
return container;
}
-// build the score text container once
scoreTxt = createScoreText(score);
scoreTxt.scaleX = 1.0;
scoreTxt.scaleY = 1.0;
LK.playMusic('bgm', {
@@ -276,8 +271,9 @@
}
}
/****
* Input Logic
+* Prevent melee attacks while jumping—but allow projectile throws.
****/
var isSequenceRunning = false;
var isJumping = false;
var playerState = 'idle';
@@ -288,14 +284,14 @@
isPressHeld = true;
pressHoldStartTime = Date.now();
pressDownX = x;
pressDownY = y;
- // Jump if tapped in top 2/3
+ // Jump if tapped in top 2/3 and not already jumping.
if (y < 2732 * 2 / 3 && !isJumping) {
isJumping = true;
LK.getSound('hup').play();
swapPlayerVisual('player_jump', player.x, player.y);
- // Dust effect
+ // Dust effect for jump.
for (var i = 0; i < 10; i++) {
var p = LK.getAsset('dust', {
anchorX: 0.5,
anchorY: 0.5,
@@ -371,59 +367,64 @@
}
});
}
});
+ // If jumping, do not schedule melee attack.
return;
}
- // Delay melee attack for a short time.
- attackTimeout = LK.setTimeout(function () {
- if (isPressHeld) {
- isSequenceRunning = true;
- var flip = x < 1024 ? -1 : 1;
- swapPlayerVisual('player_attackf01', 1024, 2732 - 250, flip);
- LK.getSound('retroslash').play();
- var vis = player.findChildByName('visual');
- if (vis) {
+ // If player is already jumping, do not schedule a melee attack.
+ if (isJumping) {
+ return;
+ }
+ // Attack if tapped in bottom 1/3 (non-jumping case)
+ isSequenceRunning = true;
+ var flip = x < 1024 ? -1 : 1;
+ swapPlayerVisual('player_attackf01', 1024, 2732 - 250, flip);
+ LK.getSound('retroslash').play();
+ var vis = player.findChildByName('visual');
+ if (vis) {
+ tween(vis, {
+ scaleX: flip * 1.3,
+ scaleY: 1.3
+ }, {
+ duration: 50,
+ onFinish: function onFinish() {
tween(vis, {
- scaleX: flip * 1.3,
- scaleY: 1.3
+ scaleX: flip * 1.0,
+ scaleY: 1.0
}, {
- duration: 50,
- onFinish: function onFinish() {
- tween(vis, {
- scaleX: flip * 1.0,
- scaleY: 1.0
- }, {
- duration: 100
- });
- }
+ duration: 100
});
}
+ });
+ }
+ attackTimeout = setTimeout(function () {
+ if (isPressHeld) {
+ isSequenceRunning = true;
+ var flip = x < 1024 ? -1 : 1;
+ swapPlayerVisual('player_attackf02', 1024, 2732 - 250, flip);
+ attackCol.width = 180;
+ attackCol.height = 180;
+ attackCol.x = flip === -1 ? 874 : 1174;
+ attackCol.y = 2732 - 250;
+ attackCol.scaleX = flip;
+ attackCol.visible = true;
LK.setTimeout(function () {
- swapPlayerVisual('player_attackf02', 1024, 2732 - 250, flip);
- attackCol.width = 180;
- attackCol.height = 180;
- attackCol.x = flip === -1 ? 874 : 1174;
- attackCol.y = 2732 - 250;
- attackCol.scaleX = flip;
- attackCol.visible = true;
- LK.setTimeout(function () {
- if (attackCol) {
- attackCol.visible = false;
- }
- swapPlayerVisual('player_idle', 1024, 2732 - 250, 1, function () {
- startBreathingAnimation();
- startTiltAnimation();
- });
- isSequenceRunning = false;
- playerState = 'idle';
- }, 250);
+ if (attackCol) {
+ attackCol.visible = false;
+ }
+ swapPlayerVisual('player_idle', 1024, 2732 - 250, 1, function () {
+ startBreathingAnimation();
+ startTiltAnimation();
+ });
+ isSequenceRunning = false;
+ playerState = 'idle';
}, 250);
}
}, 250);
};
/****
-* game.up: Reset press info and cancel melee attack if long press.
+* game.up: Reset press info.
****/
game.up = function (x, y) {
if (isPressHeld) {
var holdDuration = Date.now() - pressHoldStartTime;
@@ -485,10 +486,9 @@
}
LK.setInterval(spawnEnemy, Math.random() * 1500 + 1000);
/****
* NEW CODE: Projectile Logic
-* Modified so that when the player is jumping, the projectile spawns from a lower point
-* and forces the vertical target downward.
+* Modified for jumping so projectiles spawn from a lower point and aim downward.
****/
var projectiles = [];
function spawnProjectile(targetX, targetY) {
var proj = new Container();
@@ -499,13 +499,13 @@
LK.getSound('throwsnd').play();
// Determine the spawn position.
var spawnX = player.x;
var spawnY = player.y;
- // If player is jumping, adjust spawnY to be near the bottom of the player
- // and override the targetY so the projectile is fired downward.
+ // If the player is jumping, adjust spawnY to be near the bottom of the player
+ // and force the targetY to be downward.
if (isJumping) {
- spawnY = player.y + 100; // Adjust this offset as needed.
- targetY = spawnY + 200; // Force the projectile to aim downward.
+ spawnY = player.y + 100; // Adjust as needed.
+ targetY = spawnY + 200; // Force downward.
}
proj.x = spawnX;
proj.y = spawnY;
// Calculate direction vector from spawn position to target.
@@ -529,9 +529,9 @@
/****
* Main Update
****/
game.update = function () {
- // Check hold duration for projectile.
+ // Check hold duration for long press projectile.
if (isPressHeld) {
var holdDuration = Date.now() - pressHoldStartTime;
if (holdDuration > 500) {
console.log("Long press detected, spawn projectile!");
@@ -699,9 +699,9 @@
}
return null;
};
/****
-* game.up: Reset press info.
+* game.up: Reset Press Info
****/
game.up = function (x, y) {
isPressHeld = false;
pressHoldStartTime = 0;
high definition super nintendo background of a japanese sakura tree forest Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
2d snes dust particle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
silver coin, $ sign on it, snes art. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
gold coin, $ sign on it, snes art. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows