User prompt
Add a currency symbol asset to the left of the buttonText. Similarly it should be destroyed when destroying the buttonText
Code edit (5 edits merged)
Please save this source code
User prompt
tint NavigationButtons red. When the unlock function is called, reset the tint and destroy the buttonText
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: b is not defined' in this line: 'b;' Line Number: 142
Code edit (1 edits merged)
Please save this source code
User prompt
Convert the buttonContainer into a class called NavigationInterface
Code edit (1 edits merged)
Please save this source code
User prompt
Add 4 buttons to the bottom of the screen
Code edit (6 edits merged)
Please save this source code
User prompt
add a launch function that takes in a direction value to both the planet and ship classes
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Add two new planet classes: PlanetBlue and PlanetOmni
Code edit (2 edits merged)
Please save this source code
User prompt
Create a new planet called PlanetRed
Code edit (5 edits merged)
Please save this source code
User prompt
call the planet's update method from the global on tick callback
User prompt
in the planet update method increase the rotation by the spin value
User prompt
Planet and PlanetGrey should have a self.spin of 0 and 0.01 respectively
Code edit (1 edits merged)
Please save this source code
User prompt
add an update function to the planet class
User prompt
Instead of creating a farm on the first plot, create a ship
User prompt
a planet should randomize its rotation in it's constructor
User prompt
Set the width of the farm graphics to the PLOT_SIZE
===================================================================
--- original.js
+++ change.js
@@ -1,8 +1,7 @@
/****
* Classes
****/
-// Define the Farm class
var Farm = Container.expand(function (x, y, rotation) {
var self = Container.call(this);
var farmGraphics = self.createAsset('farm', 'Farm asset', 0.5, 0.65);
farmGraphics.width = PLOT_SIZE;
@@ -10,64 +9,72 @@
self.x = x;
self.y = y;
self.rotation = rotation;
});
-// Define the Ship class
var Ship = Container.expand(function (x, y) {
var self = Container.call(this);
var shipGraphics = self.createAsset('ship', 'Ship asset', 0.35, 0.5);
;
self.x = x;
self.y = y;
+ self.launch = function (direction) {
+ // Launch logic for the ship
+ };
});
-// Define the Planet class
var Planet = Container.expand(function (x, y, radius, assetName) {
var self = Container.call(this);
- self.x = x;
- self.y = y;
- self.radius = radius;
- self.rotation = Math.random() * 2 * Math.PI; // Randomize rotation
+ var perimeter = 2 * Math.PI * radius;
+ var numPlots = Math.floor(perimeter / (PLOT_SIZE + PLOT_GAP));
+ var numNodes = numPlots / 4;
+ var farms = [];
var ship = self.addChild(new Ship(radius, 0));
var planetGraphics = self.createAsset(assetName, assetName + ' asset', 0.5, 0.5);
- planetGraphics.width = self.radius * 2;
- planetGraphics.height = self.radius * 2;
+ planetGraphics.width = radius * 2;
+ planetGraphics.height = radius * 2;
+ ;
+ self.update = update;
+ self.launch = function (direction) {
+ // Launch logic for the planet
+ };
+ self.x = x;
+ self.y = y;
+ self.rotation = Math.random() * 2 * Math.PI;
self.spin = 0;
- // Calculate the number of plots based on the planet's perimeter
- var perimeter = 2 * Math.PI * self.radius;
- self.numPlots = Math.floor(perimeter / (PLOT_SIZE + PLOT_GAP));
- // Create farms around the perimeter of the planet
- self.farms = [];
- self.update = function () {
- // Increase the rotation by the spin value
+ ;
+ function update(ticks) {
self.rotation += self.spin;
- };
- for (var i = 1; i < self.numPlots; i++) {
- var angle = i / self.numPlots * 2 * Math.PI;
- var farmX = self.radius * Math.cos(angle);
- var farmY = self.radius * Math.sin(angle);
- var rotation = angle + Math.PI / 2;
- self.farms.push(self.addChild(new Farm(farmX, farmY, rotation)));
}
+ function createFarms() {
+ for (var i = 1; i < numPlots; i++) {
+ var angle = i / numPlots * 2 * Math.PI;
+ var farmX = radius * Math.cos(angle);
+ var farmY = radius * Math.sin(angle);
+ var rotation = angle + Math.PI / 2;
+ farms.push(self.addChild(new Farm(farmX, farmY, rotation)));
+ }
+ }
+ ;
+ createFarms();
return self;
});
-// Define the PlanetGrey class that inherits from Planet
var PlanetGrey = Planet.expand(function (x, y) {
var self = Planet.call(this, x, y, PLANET_RADIUS_GREY, 'planetGrey');
+ ;
self.spin = PLANET_SPIN_GREY;
});
-// Define the PlanetRed class that inherits from Planet
var PlanetRed = Planet.expand(function (x, y) {
var self = Planet.call(this, x, y, PLANET_RADIUS_RED, 'planetRed');
+ ;
self.spin = PLANET_SPIN_RED;
});
-// Define the PlanetBlue class that inherits from Planet
var PlanetBlue = Planet.expand(function (x, y) {
var self = Planet.call(this, x, y, PLANET_RADIUS_BLUE, 'planetBlue');
+ ;
self.spin = PLANET_SPIN_BLUE;
});
-// Define the PlanetOmni class that inherits from Planet
var PlanetOmni = Planet.expand(function (x, y) {
var self = Planet.call(this, x, y, PLANET_RADIUS_OMNI, 'planetOmni');
+ ;
self.spin = PLANET_SPIN_OMNI;
});
/****
@@ -92,9 +99,15 @@
var PLANET_SPIN_GREY = 0.001;
var PLANET_SPIN_RED = -0.0002;
var PLANET_SPIN_BLUE = 0.001;
var PLANET_SPIN_OMNI = 0.005;
-var PLOT_SIZE = 100; // Size of each farm plot
+var ROCKET_DIST_REVERSE = 200;
+var ROCKET_DIST_LEAVE = 1200;
+var ROCKET_SPEED_BASE = 0.05;
+var ROCKET_SPEED_MULTI = 1.5;
+var ROCKET_SPEED_MAX = 30;
+var ROCKET_SPEED_REVERSE = 5;
+var PLOT_SIZE = 100;
var PLOT_GAP = 40;
;
var planet = game.addChild(new PlanetOmni(GAME_WIDTH / 2, GAME_HEIGHT / 2));
;
pixel art of a tiny planet. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a planet. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of an alien currency symbol. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a planet made of gold ore. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
plain black background with stars. 2d repeating Texture.
pixel art of a asteroid. Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a cute alien farmer, side view. Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a rocky explosion.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art flame particle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a large white, empty, rectangular, speech bubble. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a red chevron. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art of yellow grapes. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.