User prompt
Fix Bug: 'TypeError: leftButton.containsPoint is not a function' in this line: 'if (leftButton.containsPoint(pos)) {' Line Number: 148
User prompt
everytime hero purplebullet makes contact with enemy, cosmiccredits = cosmiccredits + 5
User prompt
when the score increases by 1, add 5 to cosmic credits constantly
User prompt
when the score increases by 1, add 5 to cosmic credits
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'replace')' in this line: 'var cosmicCredits = Number(cosmicCreditsTxt.text.replace('Cosmic Credits: ', '')) + 5;' Line Number: 250
User prompt
everytime purplebullet makes contact with enemy, do current cosmic credits + 5
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'replace')' in this line: 'var cosmicCredits = Number(cosmicCreditsTxt.text.replace(/[^0-9]/g, '')) + 5;' Line Number: 242
User prompt
when a bullet makes contact with enemy, add 5 to cosmic credits
User prompt
below high score, add Cosmic Credits
User prompt
after an enemy has been killed, 5 cosmic credits should be added and constantly updates. However, it only updates for the first enemy kill
User prompt
5 cosmic credits per enemy killed
User prompt
the cosmic credits should update for every enemy killed. However, it only updates for one
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'setItem')' in this line: 'localStorage.setItem('cosmicCredits', cosmicCredits.toString());' Line Number: 242
User prompt
Fix Bug: 'TypeError: LK.setData is not a function' in this line: 'LK.setData('cosmicCredits', cosmicCredits);' Line Number: 242
User prompt
Fix Bug: 'TypeError: LK.setData is not a function' in this line: 'LK.setData('cosmicCredits', cosmicCredits);' Line Number: 242
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'getItem')' in this line: 'var cosmicCredits = Number(localStorage.getItem('cosmicCredits') || 0) + 5;' Line Number: 240
User prompt
Fix Bug: 'TypeError: LK.getData is not a function' in this line: 'var cosmicCredits = Number(LK.getData('cosmicCredits') || 0) + 5;' Line Number: 240
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'getItem')' in this line: 'var cosmicCredits = Number(localStorage.getItem('cosmicCredits') || 0) + 5;' Line Number: 240
User prompt
Fix Bug: 'TypeError: LK.getData is not a function' in this line: 'var cosmicCredits = Number(LK.getData('cosmicCredits') || 0) + 5;' Line Number: 240
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'getItem')' in this line: 'var cosmicCredits = Number(localStorage.getItem('cosmicCredits') || 0) + 5;' Line Number: 240
User prompt
Fix Bug: 'TypeError: LK.getData is not a function' in this line: 'var cosmicCredits = Number(LK.getData('cosmicCredits') || 0) + 5;' Line Number: 240
User prompt
Fix Bug: 'TypeError: LK.retrieveData is not a function' in this line: 'var cosmicCredits = Number(LK.retrieveData('cosmicCredits') || 0) + 5;' Line Number: 240
User prompt
Fix Bug: 'TypeError: LK.getData is not a function' in this line: 'var cosmicCredits = Number(LK.getData('cosmicCredits') || 0) + 5;' Line Number: 240
User prompt
below high score, make a new currency called "Cosmic Credits". 5 Cosmic Credits per enemy killed
User prompt
make it so you get 5 Cosmic Credits per enemy hit
===================================================================
--- original.js
+++ change.js
@@ -164,21 +164,20 @@
var highScoreTxt = new Text2('High Score: 0 (WIP)', {
size: 50,
fill: "#ffffff"
});
-// Initialize Cosmic Credits display
+scoreTxt.anchor.set(1, 0);
+highScoreTxt.anchor.set(1, 0);
+highScoreTxt.y = scoreTxt.height + 20;
var cosmicCreditsTxt = new Text2('Cosmic Credits: 0', {
size: 50,
fill: "#ffffff"
});
cosmicCreditsTxt.anchor.set(1, 0);
-cosmicCreditsTxt.y = highScoreTxt.y + highScoreTxt.height * 2 + 50;
-LK.gui.topRight.addChild(cosmicCreditsTxt);
-scoreTxt.anchor.set(1, 0);
-highScoreTxt.anchor.set(1, 0);
-highScoreTxt.y = scoreTxt.height + 20;
+cosmicCreditsTxt.y = highScoreTxt.y + highScoreTxt.height + 20;
LK.gui.topRight.addChild(scoreTxt);
LK.gui.topRight.addChild(highScoreTxt);
+LK.gui.topRight.addChild(cosmicCreditsTxt);
// Create bullet count display
var bulletCountTxt = new Text2('Bullets: 3', {
size: 100,
fill: "#ffffff"
@@ -237,16 +236,13 @@
} else {
// If the enemy is an actual enemy
// Update score
var newScore = LK.getScore() + 1;
+ var cosmicCredits = Number(LK.getData('cosmicCredits') || 0) + 5;
LK.setScore(newScore);
+ LK.setData('cosmicCredits', cosmicCredits);
scoreTxt.setText('Score: ' + newScore);
- // Increment Cosmic Credits by 5 for each enemy hit
- var cosmicCredits = Number((typeof localStorage !== 'undefined' ? localStorage.getItem('cosmicCredits') : '0') || '0') + 25;
cosmicCreditsTxt.setText('Cosmic Credits: ' + cosmicCredits);
- if (typeof localStorage !== 'undefined') {
- localStorage.setItem('cosmicCredits', cosmicCredits.toString());
- }
var highScore = Math.max(newScore, Number((typeof localStorage !== 'undefined' ? localStorage.getItem('highScore') : '0') || '0'));
highScoreTxt.setText('High Score: ' + highScore + ' (WIP)');
if (typeof localStorage !== 'undefined' && newScore > highScore) {
localStorage.setItem('highScore', newScore.toString());
android. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
letter X png. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
space background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
galaxy background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
galaxy background. High quality
space background.. High contrast