Code edit (3 edits merged)
Please save this source code
User prompt
the player is too far left, his entire image must fit in the playspace
Code edit (1 edits merged)
Please save this source code
User prompt
create an animation introduction with player, he should start outside of the screen and make his way into the playspace on the bottom left of the playspace
User prompt
delete all code
Initial prompt
TestCase000
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,34 @@
-/****
+/****
+* Classes
+****/
+// Create a Player class by using the LK expand method to extend Container.
+var Player = Container.expand(function () {
+ var self = Container.call(this);
+ // Get and automatically addChild to self asset with id 'Player' with the anchor point set to .5, .5
+ var playerGraphics = self.attachAsset('Player', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
backgroundColor: 0x000000
-});
\ No newline at end of file
+});
+
+/****
+* Game Code
+****/
+// Initialize the player object and position it outside the screen
+var player = game.addChild(new Player());
+player.x = -player.width;
+player.y = 2732 - player.height;
+// Ask LK engine to update game every game tick. Use this instead of Tweens
+game.update = function () {
+ // Move the player into the playspace
+ if (player.x < 0) {
+ player.x += 5;
+ }
+};
\ No newline at end of file