User prompt
move player_dle a little bit higher
User prompt
move player_dle to the bottom of the playspace
User prompt
create and place on the playspace bg01 at gamestart behind player
User prompt
make sure it loops
User prompt
Simulate breathing with player_idle by scaling it up and down is not working when its re-instanciated, fix it ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Simulate breathing with player_idle by scaling it up and down is not working, fix it ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
play retroslash when player_attackf01 is instantiated
User prompt
Don't stretch bg01
User prompt
Bg01 should be visible at start, right now it appears when I tap the screen
User prompt
Fit bg01 to screen
User prompt
Instantiate and center bg01 behind player
User prompt
jumping keeps the player_idle visuals
User prompt
if I click on the upper portion of the playspace my player should simulate jumping and not attacking
User prompt
if I click on the upper portion of the playspace my player should simulate jumping and not attacking
User prompt
if I click on the upper portion of the playspace my player should simulate jumping
User prompt
reduce the delay between the asset swaps
User prompt
reduce the delay between the asset swaps
User prompt
player_attackf02 is not flipping correctly
User prompt
if I click on the right portion of the playspace, the sequence stays the same, if I click on the left portion of the playspace, the sequence flips the character visuals
User prompt
its not working player_idle, player_attackf01 & 02 are not swapping in X
User prompt
if i click on the left side of the screen, the asset should flip, if i click on the right side of the screen, the asset should stay the same
User prompt
reduce the delay between the asset swaps
User prompt
make the sequence smoother, its too slow ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Timeout.tick error: playerIdle is not defined' in or related to this line: 'tween(playerIdle, {' Line Number: 140
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Create a new class for the player_attackf01 asset var PlayerAttack = Container.expand(function () { var self = Container.call(this); // Attach the player_attackf01 asset to the PlayerAttack class var playerAttackGraphics = self.attachAsset('player_attackf01', { anchorX: 0.5, anchorY: 0.5 }); }); /**** * Initialize Game ****/ // Mouse or touch down on the game object var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Create a new instance of the player_idle asset var player = LK.getAsset('player_idle', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); // Boolean to track if the sequence is running var isSequenceRunning = false; // Boolean to track if player_idle is on screen var isPlayerIdleOnScreen = false; // Add the player to the game game.addChild(player); isPlayerIdleOnScreen = true; // Import the tween plugin // Simulate breathing with player_idle by scaling it up and down 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: function onFinish() { // Repeat the animation tween(player, { scaleX: 1.05, scaleY: 1.05 }, { duration: 1000, easing: tween.easeInOut, onFinish: function onFinish() { // Repeat the animation tween(player, { scaleX: 1.0, scaleY: 1.0 }, { duration: 1000, easing: tween.easeInOut, onFinish: onFinish }); } }); } }); } }); // Mouse or touch down on the game object game.down = function (x, y, obj) { // Check if the sequence is already running if (isSequenceRunning) { return; // Exit if the sequence is already running } // Set the sequence running flag to true isSequenceRunning = true; // Destroy the player_idle asset if it exists if (player) { player.destroy(); isPlayerIdleOnScreen = false; } // Determine if the click is on the left or right portion of the playspace var isLeftClick = x < 2048 / 2; // Create a new instance of the PlayerAttack class var playerAttack = new PlayerAttack(); // Play the 'retroslash' sound LK.getSound('retroslash').play(); // Flip the player visuals if clicked on the left portion if (isLeftClick) { playerAttack.scaleX = -1; } // Position the player_attackf01 asset at the center of the screen playerAttack.x = 2048 / 2; playerAttack.y = 2732 / 2; // Add the player_attackf01 asset to the game game.addChild(playerAttack); // After 0.15 seconds, replace player_attackf01 with player_attackf02 LK.setTimeout(function () { // Destroy player_attackf01 playerAttack.destroy(); // Create a new instance of player_attackf02 var playerAttack2 = LK.getAsset('player_attackf02', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); // Flip the player visuals if clicked on the left portion for player_attackf02 if (isLeftClick) { playerAttack2.scaleX = -1; } // Add player_attackf02 to the game game.addChild(playerAttack2); // After 0.15 seconds, replace player_attackf02 with player_idle LK.setTimeout(function () { // Destroy player_attackf02 playerAttack2.destroy(); // Check if player_idle is already on screen if (!isPlayerIdleOnScreen) { // Reuse the existing player instance for player_idle player = LK.getAsset('player_idle', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); // Add player_idle to the game game.addChild(player); isPlayerIdleOnScreen = true; // Simulate breathing with player_idle by scaling it up and down 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: onFinish }); } }); } // Simulate breathing with player_idle by scaling it up and down 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: onFinish }); } }); // Set the sequence running flag to false isSequenceRunning = false; isPlayerIdleOnScreen = true; }, 250); }, 250); };
===================================================================
--- original.js
+++ change.js
@@ -26,18 +26,8 @@
/****
* Game Code
****/
-// Instantiate and fit bg01 to screen
-var bg = LK.getAsset('bg01', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: 2048 / 2,
- y: 2732 / 2,
- scaleX: 2048 / 2000,
- scaleY: 2732 / 2000
-});
-game.addChildAt(bg, 0);
// Create a new instance of the player_idle asset
var player = LK.getAsset('player_idle', {
anchorX: 0.5,
anchorY: 0.5,
@@ -102,20 +92,14 @@
if (player) {
player.destroy();
isPlayerIdleOnScreen = false;
}
- // Instantiate bg01 and center it without stretching
- var bg = LK.getAsset('bg01', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: 2048 / 2,
- y: 2732 / 2
- });
- game.addChildAt(bg, 0);
// Determine if the click is on the left or right portion of the playspace
var isLeftClick = x < 2048 / 2;
// Create a new instance of the PlayerAttack class
var playerAttack = new PlayerAttack();
+ // Play the 'retroslash' sound
+ LK.getSound('retroslash').play();
// Flip the player visuals if clicked on the left portion
if (isLeftClick) {
playerAttack.scaleX = -1;
}
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
snes white feather. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
add a wooden shield
white 3d questionmark with a shadow. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
caligraphy paper front facing flat. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
the letters 'Ready' in 3d with a japanese cartoon cherry blossom flair. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
add eyebrows