Question:
The system in my game for adding upgrades works the same way as adding buildings, you add all their proprieties to different lost then uses a for loop to make them work. However, when I try to add more then 1 upgrade it doesn’t work (neither the old or new one appears). I did some looking into it and the problem starts when I add a value to the requirement
list, after that none of the upgrades appear. When I delete the code for the second upgrade it works just fine
Repl link:
https://replit.com/@JohnnySuriano/Cycle-Clicker
Working Code
let upgrade = {
name: [
'Touch Typing'
],
description: [
'Cursors are now twice as efficient'
],
image: [
'touchtyping.png'
],
type: [
'building'
],
cost: [
'300'
],
buildingIndex: [
0
],
requirement: [
1
],
bonus: [
2
],
purchased: [false],
//} closed later
Not Working Code
let upgrade = {
name: [
'Touch Typing',
'test'
],
description: [
'Cursors are now twice as efficient',
'test'
],
image: [
'touchtyping.png',
'djoint.png'
],
type: [
'building',
'building'
],
cost: [
'300',
'700'
],
buildingIndex: [
0,
0
],
requirement: [
1,
5
],
bonus: [
2
],
purchased: [false, false],
//} closed later
Thanks again for any help!