Code edit (4 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
сделай чтобы после прыжка игрок не уменьшался
Code edit (7 edits merged)
Please save this source code
User prompt
добавь еще несколько типов объектов и комбинируй их
User prompt
добавь еще несколько типов объектов на орбиты и делай из них различные сочетания
Code edit (2 edits merged)
Please save this source code
User prompt
сделай чтобы игрок всегда смотрел в центр экрана
User prompt
Fix Bug: 'ReferenceError: Star is not defined' in or related to this line: 'if (child instanceof Star) {' Line Number: 359
User prompt
Fix Bug: 'ReferenceError: Star is not defined' in or related to this line: 'if (child instanceof Star) {' Line Number: 359
User prompt
добавь на задний фон эффект звезд летящих в экран
User prompt
добавь blackSphere эффект летящих звезд
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'width')' in or related to this line: 'player.radius = orbits[currentOrbitIndex].width / 2 - 50;' Line Number: 346
===================================================================
--- original.js
+++ change.js
@@ -157,43 +157,185 @@
self.addChild(powerup);
obstacles.push(powerup);
};
});
-// Star class
-var Star = Container.expand(function () {
- var self = Container.call(this);
- var starGraphics = self.attachAsset('blackSphere', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: Math.random() * 10 + 1,
- height: Math.random() * 10 + 1
- });
- starGraphics.alpha = Math.random() * 0.5 + 0.5;
- self.speed = Math.random() * 2 + 1;
- self.z = Math.random() * 500 + 50; // Z position for depth effect
- self.move = function () {
- self.z -= self.speed;
- var scale = 500 / self.z;
- self.scale.x = self.scale.y = scale > 1 ? 1 : scale; // Ensure scale does not exceed 1
- self.alpha = scale; // Fade out as it moves closer
- if (self.z <= 0) {
- self.x = Math.random() * 2048;
- self.y = Math.random() * 2732;
- self.z = Math.random() * 500 + 50;
- }
- };
-});
/****
* Initialize Game
****/
+// Star class
var game = new LK.Game({
backgroundColor: 0x000000 // Init game with black background
});
/****
* Game Code
****/
+// Star class
+function _typeof(o) {
+ "@babel/helpers - typeof";
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
+ return typeof o;
+ } : function (o) {
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
+ }, _typeof(o);
+}
+function _classCallCheck(instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+}
+function _defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) {
+ descriptor.writable = true;
+ }
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
+ }
+}
+function _createClass(Constructor, protoProps, staticProps) {
+ if (protoProps) {
+ _defineProperties(Constructor.prototype, protoProps);
+ }
+ if (staticProps) {
+ _defineProperties(Constructor, staticProps);
+ }
+ Object.defineProperty(Constructor, "prototype", {
+ writable: false
+ });
+ return Constructor;
+}
+function _toPropertyKey(t) {
+ var i = _toPrimitive(t, "string");
+ return "symbol" == _typeof(i) ? i : String(i);
+}
+function _toPrimitive(t, r) {
+ if ("object" != _typeof(t) || !t) {
+ return t;
+ }
+ var e = t[Symbol.toPrimitive];
+ if (void 0 !== e) {
+ var i = e.call(t, r || "default");
+ if ("object" != _typeof(i)) {
+ return i;
+ }
+ throw new TypeError("@@toPrimitive must return a primitive value.");
+ }
+ return ("string" === r ? String : Number)(t);
+}
+function _inherits(subClass, superClass) {
+ if (typeof superClass !== "function" && superClass !== null) {
+ throw new TypeError("Super expression must either be null or a function");
+ }
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
+ constructor: {
+ value: subClass,
+ writable: true,
+ configurable: true
+ }
+ });
+ Object.defineProperty(subClass, "prototype", {
+ writable: false
+ });
+ if (superClass) {
+ _setPrototypeOf(subClass, superClass);
+ }
+}
+function _setPrototypeOf(o, p) {
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
+ o.__proto__ = p;
+ return o;
+ };
+ return _setPrototypeOf(o, p);
+}
+function _createSuper(Derived) {
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
+ return function _createSuperInternal() {
+ var Super = _getPrototypeOf(Derived),
+ result;
+ if (hasNativeReflectConstruct) {
+ var NewTarget = _getPrototypeOf(this).constructor;
+ result = Reflect.construct(Super, arguments, NewTarget);
+ } else {
+ result = Super.apply(this, arguments);
+ }
+ return _possibleConstructorReturn(this, result);
+ };
+}
+function _possibleConstructorReturn(self, call) {
+ if (call && (_typeof(call) === "object" || typeof call === "function")) {
+ return call;
+ } else if (call !== void 0) {
+ throw new TypeError("Derived constructors may only return object or undefined");
+ }
+ return _assertThisInitialized(self);
+}
+function _assertThisInitialized(self) {
+ if (self === void 0) {
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
+ }
+ return self;
+}
+function _isNativeReflectConstruct() {
+ if (typeof Reflect === "undefined" || !Reflect.construct) {
+ return false;
+ }
+ if (Reflect.construct.sham) {
+ return false;
+ }
+ if (typeof Proxy === "function") {
+ return true;
+ }
+ try {
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
+ return true;
+ } catch (e) {
+ return false;
+ }
+}
+function _getPrototypeOf(o) {
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
+ return o.__proto__ || Object.getPrototypeOf(o);
+ };
+ return _getPrototypeOf(o);
+}
+var Star = /*#__PURE__*/function (_Container) {
+ _inherits(Star, _Container);
+ var _super = _createSuper(Star);
+ function Star() {
+ var _this;
+ _classCallCheck(this, Star);
+ _this = _super.call(this);
+ var starGraphics = _this.attachAsset('blackSphere', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: Math.random() * 10 + 1,
+ height: Math.random() * 10 + 1
+ });
+ starGraphics.alpha = Math.random() * 0.5 + 0.5;
+ _this.speed = Math.random() * 2 + 1;
+ _this.z = Math.random() * 500 + 50; // Z position for depth effect
+ return _this;
+ }
+ _createClass(Star, [{
+ key: "move",
+ value: function move() {
+ this.z -= this.speed;
+ var scale = 500 / this.z;
+ this.scale.x = this.scale.y = scale > 1 ? 1 : scale; // Ensure scale does not exceed 1
+ this.alpha = scale; // Fade out as it moves closer
+ if (this.z <= 0) {
+ this.x = Math.random() * 2048;
+ this.y = Math.random() * 2732;
+ this.z = Math.random() * 500 + 50;
+ }
+ }
+ }]);
+ return Star;
+}(Container);
function hsvToHex(h, s, v) {
var r, g, b, i, f, p, q, t;
i = Math.floor(h * 6);
f = h * 6 - i;
астероид. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Контейнер с энергией. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
черный круг с белыми точками. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.