Code edit (2 edits merged)
Please save this source code
User prompt
Move the column shadow to the box class
Code edit (2 edits merged)
Please save this source code
User prompt
column shadow is only visible if the boxes array size is greater than the count
Code edit (1 edits merged)
Please save this source code
User prompt
Columns should have a sub-container called boxContainer that holds Boxes
Code edit (7 edits merged)
Please save this source code
User prompt
Columns have a shadow asset which has its y property set to: `STAGE_HEIGHT - FLOOR_OFFSET - BOX_HEIGHT * self.count` in the update function
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
convert interface text2 to use BorderedText instead
Code edit (3 edits merged)
Please save this source code
User prompt
add a background class
User prompt
Add a fullscreen background before the floor
Code edit (4 edits merged)
Please save this source code
User prompt
Display the following text under the score "Swipe left or right to move" and "Swipe up or tap to jump" under that
User prompt
set initial invulnerability to 0
User prompt
player no longer starts invulnerable
Code edit (1 edits merged)
Please save this source code
User prompt
player starts with invulnerability equal to INVULNERABILITY_TIME
Code edit (1 edits merged)
Please save this source code
User prompt
flash the player black when invulnerability reaches 60 and 30
User prompt
tint the player gold while it is invulnerable
Code edit (1 edits merged)
Please save this source code
User prompt
decrement player invulnerability in it's update function if it's greater than 0
===================================================================
--- original.js
+++ change.js
@@ -1,4 +1,45 @@
+var BorderedText = Container.expand(function (string, settings) {
+ var self = Container.call(this);
+ var textList = [];
+ var defaultFill = '#ffffff';
+ var defaultBorder = '#000000';
+ var defaultFont = 'bold monospace';
+ var defaultSize = 50;
+ var defaultWeight = 2;
+ var offsets = [[-1, -1], [-1, 1], [1, 1], [1, -1], [0, 0]];
+ var borderSettings = {
+ fill: settings.border || defaultBorder,
+ font: settings.font || defaultFont,
+ size: settings.size || defaultSize
+ };
+ var textSettings = {
+ fill: settings.fill || defaultFill,
+ font: settings.font || defaultFont,
+ size: settings.size || defaultSize
+ };
+ self.x = settings.x;
+ self.y = settings.y;
+ for (var i = 0; i < offsets.length; i++) {
+ var localSettings = i === offsets.length - 1 ? textSettings : borderSettings;
+ var text = new Text2(string, localSettings);
+ text.x += offsets[i][0] * defaultWeight;
+ text.y += offsets[i][1] * defaultWeight;
+ if (settings.anchor) {
+ text.anchor.set(settings.anchor.x, settings.anchor.y);
+ }
+ textList.push(text);
+ self.addChild(text);
+ }
+ self.setText = function (string) {
+ for (var i = 0; i < textList.length; i++) {
+ textList[i].setText(string);
+ }
+ };
+ self.setFill = function (newFill) {
+ textList[textList.length - 1].fill = newFill;
+ };
+});
var Background = Container.expand(function (parent) {
var self = Container.call(this);
parent.addChild(self);
var backgroundGraphics = self.createAsset('background', 'Background image', 0.5, 0.5);
@@ -19,19 +60,40 @@
var self = Container.call(this);
parent.addChild(self);
;
var score = 0;
- var scoreTxt = new Text2(score.toString(), {
+ var scoreTxt = new BorderedText(score.toString(), {
size: 150,
- fill: "#ffffff"
+ fill: '#ffffff',
+ border: '#000000',
+ x: 0,
+ y: 0,
+ anchor: {
+ x: .5,
+ y: 0
+ }
});
- var moveInstructions = new Text2('Swipe left or right to move', {
+ var moveInstructions = new BorderedText('Swipe left or right to move', {
size: 80,
- fill: "#ffffff"
+ fill: '#ffffff',
+ border: '#000000',
+ x: 0,
+ y: scoreTxt.height + 20,
+ anchor: {
+ x: .5,
+ y: 0
+ }
});
- var jumpInstructions = new Text2('Swipe up or tap to jump', {
+ var jumpInstructions = new BorderedText('Swipe up or tap to jump', {
size: 80,
- fill: "#ffffff"
+ fill: '#ffffff',
+ border: '#000000',
+ x: 0,
+ y: moveInstructions.y + moveInstructions.height + 10,
+ anchor: {
+ x: .5,
+ y: 0
+ }
});
scoreTxt.anchor.set(.5, 0);
moveInstructions.anchor.set(.5, 0);
moveInstructions.y = scoreTxt.height + 20;
Pixel art, side view of a concrete factory floor . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art, square with cute eyes . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art, square with the texture of a tnt . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a crate, side view . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a crate, flat side view . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a crate, flat side view . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art of a golden christmas present. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art of a green christmas present with red ribbons. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art of an elaborate green christmas present with red ribbons. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a metal background.
pixel art of a crate made of stone with a label of coal on the side, flat side view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a square tnt explosion. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.