Code edit (3 edits merged)
Please save this source code
User prompt
когда открывается сундук из него вылетают 10 Coin - направление "вверх" + случайное значение от 0 до 90. На Coin действует гравитация, сила гравитации = 1.
Code edit (1 edits merged)
Please save this source code
User prompt
Если кликнуть на сундук, он превращается в ChestOpen
User prompt
Сундук стоит в центре экрана.
User prompt
Курсор мыши в тех же координатах, что и объект Cursor.
Code edit (1 edits merged)
Please save this source code
User prompt
как сделать главное меню? Отвечай на русском языке, но код пиши на английском.
Initial prompt
Dungeon Logic System
/**** * Classes ****/ var Chest = Container.expand(function () { var self = Container.call(this); var chestGraphics = self.attachAsset('Chest', { anchorX: 0.5, anchorY: 0.5 }); self.down = function (x, y, obj) { var chestOpen = game.addChild(new ChestOpen()); chestOpen.x = self.x; chestOpen.y = self.y; self.destroy(); }; }); var ChestOpen = Container.expand(function () { var self = Container.call(this); var chestOpenGraphics = self.attachAsset('ChestOpen', { anchorX: 0.5, anchorY: 0.5 }); }); var Cursor = Container.expand(function () { var self = Container.call(this); var cursorGraphics = self.attachAsset('Cursor', { anchorX: 0.5, anchorY: 0.5 }); }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var chest = game.addChild(new Chest()); chest.x = 2048 / 2; chest.y = 2732 / 2; var cursor = game.addChild(new Cursor()); game.move = function (x, y, obj) { cursor.x = x; cursor.y = y; };
===================================================================
--- original.js
+++ change.js
@@ -6,9 +6,22 @@
var chestGraphics = self.attachAsset('Chest', {
anchorX: 0.5,
anchorY: 0.5
});
+ self.down = function (x, y, obj) {
+ var chestOpen = game.addChild(new ChestOpen());
+ chestOpen.x = self.x;
+ chestOpen.y = self.y;
+ self.destroy();
+ };
});
+var ChestOpen = Container.expand(function () {
+ var self = Container.call(this);
+ var chestOpenGraphics = self.attachAsset('ChestOpen', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+});
var Cursor = Container.expand(function () {
var self = Container.call(this);
var cursorGraphics = self.attachAsset('Cursor', {
anchorX: 0.5,