/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var GameObject = Container.expand(function () {
var self = Container.call(this);
// Attach a shape asset to the game object
var gameObjectGraphics = self.attachAsset('character', {
anchorX: 0.5,
anchorY: 0.5
});
// Set the initial position of the game object
self.x = 1024;
self.y = 1366;
// This is automatically called every game tick, if the game object is attached!
self.update = function () {
// Apply a tween animation to the game object
tween(self, {
x: 500,
y: 500
}, {
duration: 2000,
easing: tween.easeInOut
});
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Add the game object to the game
var gameObject = game.addChild(new GameObject());
// Call the update function of the game object
gameObject.update(); /****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var GameObject = Container.expand(function () {
var self = Container.call(this);
// Attach a shape asset to the game object
var gameObjectGraphics = self.attachAsset('character', {
anchorX: 0.5,
anchorY: 0.5
});
// Set the initial position of the game object
self.x = 1024;
self.y = 1366;
// This is automatically called every game tick, if the game object is attached!
self.update = function () {
// Apply a tween animation to the game object
tween(self, {
x: 500,
y: 500
}, {
duration: 2000,
easing: tween.easeInOut
});
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Add the game object to the game
var gameObject = game.addChild(new GameObject());
// Call the update function of the game object
gameObject.update();