Code edit (1 edits merged)
Please save this source code
User prompt
in the character update method, call the update method of the right and left arms, using the runAlpha as the alpha value
User prompt
Add a runAlpha variable to the Character class and increase its value by 0.02 in the update method, additionally, reduce the value by 1 if the value is >= 1
User prompt
Add a runAlpha variable to the Character class and increase its value in the update method
User prompt
Add an alpha = 0 variable to the character and increase its value by 0.02 in the update method reducing the value by 1 if it's value >= 1
User prompt
add an arm swinging animation to the CharacterArm's update function, these should be constructed from sinusoidal equations based on the alpha
User prompt
The CharacterArm and CharacterLeg classes should have empty update methods that takes in an alpha value
User prompt
Create an CharacterArm class and a CharacterLeg class, these should contain the respective upper and lower component images instead of the Character class
User prompt
add a basic running animation to the character in the update method
User prompt
the character should have 2 legs and 2 arms
User prompt
add an ontick even to the game which should call the created character's update method
User prompt
add an empty update function to the character class
User prompt
display a character in the middle of the screen
User prompt
Create a Character class that's a side-view of a person. It should be composed of different individual body parts: upper and lower arms, upper and lower legs, and the body (which will include the head).
User prompt
Remove all the code in the game
Initial prompt
Road Runners
/**** * Classes ****/ var Character = Container.expand(function () { var self = Container.call(this); // Create and attach body parts var body = self.attachAsset('body', { anchorX: 0.5, anchorY: 0.5 }); var upperArm = self.attachAsset('upperArm', { anchorX: 0.5, anchorY: 0.5 }); var lowerArm = self.attachAsset('lowerArm', { anchorX: 0.5, anchorY: 0.5 }); var upperLeg = self.attachAsset('upperLeg', { anchorX: 0.5, anchorY: 0.5 }); var lowerLeg = self.attachAsset('lowerLeg', { anchorX: 0.5, anchorY: 0.5 }); // Position body parts body.x = 0; body.y = 0; upperArm.x = 0; upperArm.y = -body.height / 2; lowerArm.x = 0; lowerArm.y = upperArm.y - upperArm.height; upperLeg.x = 0; upperLeg.y = body.height / 2; lowerLeg.x = 0; lowerLeg.y = upperLeg.y + upperLeg.height; // Add an empty update function to the Character class self.update = function () {}; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var character = game.addChild(new Character()); // Position character at the center of the screen character.x = 2048 / 2; character.y = 2732 / 2; // Add an ontick event to the game which calls the character's update method LK.on('tick', function () { character.update(); });
===================================================================
--- original.js
+++ change.js
@@ -51,5 +51,9 @@
****/
var character = game.addChild(new Character());
// Position character at the center of the screen
character.x = 2048 / 2;
-character.y = 2732 / 2;
\ No newline at end of file
+character.y = 2732 / 2;
+// Add an ontick event to the game which calls the character's update method
+LK.on('tick', function () {
+ character.update();
+});
\ No newline at end of file
white
white
circle sliced into many pieces, flat image. 2d, white background, shadowless.
pixel art of a tall, tree. game asset, 2d, white background, shadowless.
Pixel art street lamp. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art cloud. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art sun. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.