extends Node2D #Cupcake Values var ccVanNum: int = 0 var ccVanValue: int = 1 var ccChocNum: int = 0 var ccChocValue: int = 1 var ccStrawNum: int = 0 var ccStrawValue: int = 1 var ccRVelNum: int = 0 var ccRVelValue: int = 1 var ccCinNum: int = 0 var ccCinValue: int = 1 var ccHonNum: int = 0 var ccHonValue: int = 1 var ccNightmareNum: int = 0 var ccNightmareValue: int = 1 #Cupcake Upgrade Prices var ccVanPrice: int = 10 var ccVanPrice2: int = 15 var ccVanPrice3: int = 15 var ccVanPrice4: int = 250 var ccChocPrice: int = 10 var ccChocPrice2: int = 15 var ccChocPrice3: int = 15 var ccChocPrice4: int = 500 var ccChocPrice5: int var ccChocPrice6: int var ccStrawPrice: int = 10 var ccStrawPrice2: int = 15 var ccStrawPrice3: int = 15 var ccStrawPrice4: int = 750 var ccStrawPrice5: int = 150 var ccStrawPrice6: int = 200 var ccRVelPrice: int = 10 var ccRVelPrice2: int = 15 var ccRVelPrice3: int = 15 var ccRVelPrice4: int = 1000 var ccCinPrice: int = 10 var ccCinPrice2: int = 15 var ccCinPrice3: int = 15 var ccCinPrice4: int = 1250 var ccNonPrice: int = 10 var ccHonPrice2: int = 15 var ccHonPrice3: int = 15 var ccHonPrice4: int = 1500 var ccNightPrice: int = 10 var ccNightPrice2: int = 15 var ccNightPrice3: int = 15 var ccNightPrice4: int = 1750 #Upgrade counts var vanUpNum1: int = 0 var vanUpNum2: int = 0 var vanUpNum3: int = 0 var vanUpNum4: int = 0 var chocUpNum1: int = 0 var chocUpNum2: int = 0 var chocUpNum3: int = 0 var chocUpNum4: int = 0 var chocUpNum5: int = 0 var chocUpNum6: int = 0 var strawUpNum1: int = 0 #Preloaded scenes and scripts var upgradeUI = preload("res://Scenes/UI/upgrades.tscn") var location = preload("res://Scenes/Locations/yard.tscn") var horse_scene = preload("res://Scenes/horse.tscn") var horse = preload("res://Scripts/horse.gd") var ccVanilla = preload("res://Scenes/Cupcakes/cupcake.tscn") var ccChocolate = preload("res://Scenes/Cupcakes/chocCupcake.tscn") var ccStrawberry = preload("res://Scenes/Cupcakes/strawCupcake.tscn") var ccRedVelvet var ccCinnamon var ccHonest var ccNightmare var ccRock var ccRuby var ccSapphire var ccEmerald var ccDiamond var ccLoyal var ccChaos #Instantiations var ccVan = ccVanilla.instantiate() var ccChoc = ccChocolate.instantiate() var ccStraw = ccStrawberry.instantiate() var ccRVel = ccRedVelvet var ccCin = ccCinnamon var ccHon = ccHonest var ccNight = ccNightmare var ccRoc = ccRock var ccRub = ccRuby var ccSap = ccSapphire var ccEme = ccEmerald var ccDia = ccDiamond var ccLoy = ccLoyal var ccCha = ccChaos #Cupcake Locks var ccChocLocked = true var ccStrawLocked = true var ccRVelLocked = true var ccCinLocked = true var ccHonLocked = true var ccNightLocked = true var ccRocLocked = true var ccRubLocked = true var ccSapLocked = true var ccEmeLocked = true var ccDiaLocked = true var ccChaLocked = true #Spawnrates var ccVanSpawnRate = 30 var ccChocSpawnRate = 30 var ccStrawSpawnRate = 30 var ccRVelSpawnRate = 3 var ccNightSpawnRate = 3 var ccRocSpawnRate = 3 var ccRubSpawnRate = 3 var ccSapSpawnRate = 3 var ccEmeSpawnRate = 3 var ccDiaSpawnRate = 3 var ccChaSpawnRate = 3 #Combo var comboLocked = true var combo = 1.00 var comboMultiplier #Other @onready var timer = get_node("Cupcake Spawn Timer") var horseAttached = true var horse_instance var mouse_position = Vector2.ZERO var ccCount = 0 var ccMaxOnScreen = 3000 #General func _ready(): var spawn horse_instance = horse_scene.instantiate() spawn = location.instantiate() $Location.add_child(spawn) add_child(horse_instance) func _process(delta): if horseAttached == true: mouse_position = get_global_mouse_position() horse_instance.position = mouse_position handleInput() func handleInput(): if Input.is_action_pressed("horseAttach"): if horseAttached == true: horseAttached = false else: horseAttached = true func collectCupcakes(): $InGameUI/Num/NumGrid/ccVanNum.text = str(ccVanNum) $InGameUI/Num/NumGrid/ccChocNum.text = str(ccChocNum) $InGameUI/Num/NumGrid/ccStrawNum.text = str(ccStrawNum) $InGameUI/Num/NumGrid/ccRVelNum.text = str(ccRVelNum) $InGameUI/Num/NumGrid/ccCinNum.text = str(ccCinNum) $InGameUI/Num/NumGrid/ccHonNum.text = str(ccHonNum) $InGameUI/Num/NumGrid/ccNightNum.text = str(ccNightmareNum) func _on_timeout(): spawnVanCupcakes() if ccChocLocked == false: spawnChocCupcakes() if ccStrawLocked == false: spawnStrawCupcakes() if ccRVelLocked == false: spawnRVelCupcakes() if ccCinLocked == false: spawnCinCupcakes() if ccHonLocked == false: spawnHonCupcakes() if ccNightLocked == false: spawnNightCupcakes() collectCupcakes() timer.start #Spawn func spawnVanCupcakes(): var randX var randY randomize() if ccCount <= ccMaxOnScreen: for i in range(ccVanSpawnRate): randX = randi_range(10, 1910) randY = randi_range(10, 1070) ccVan.position = Vector2(randX, randY) $Cupcakes.add_child(ccVan.duplicate()) ccCount = ccCount + ccVanSpawnRate func spawnChocCupcakes(): var randX var randY randomize() if ccCount <= ccMaxOnScreen: for i in range(ccChocSpawnRate): randX = randi_range(10, 1910) randY = randi_range(10, 1070) ccChoc.position = Vector2(randX, randY) $Cupcakes.add_child(ccChoc.duplicate()) ccCount = ccCount + ccChocSpawnRate func spawnStrawCupcakes(): var randX var randY randomize() if ccCount <= ccMaxOnScreen: for i in range(ccStrawSpawnRate): randX = randi_range(10, 1910) randY = randi_range(10, 1070) ccStraw.position = Vector2(randX, randY) $Cupcakes.add_child(ccStraw.duplicate()) ccCount = ccCount + ccStrawSpawnRate func spawnRVelCupcakes(): pass func spawnCinCupcakes(): pass func spawnHonCupcakes(): pass func spawnNightCupcakes(): pass ###Upgrades### #Vanilla func _on_upgrades_one_more_cupcake(): if ccVanNum >= ccVanPrice: ccVanSpawnRate += 1 ccVanNum -= ccVanPrice ccVanPrice = ccVanPrice * 1.3 vanUpNum1 += 1 $Upgrades/Control/VanScroll/VanGrid/VanUp1/Price.text = str(ccVanPrice) collectCupcakes() func _on_upgrades_faster_cupcake(): if ccVanNum >= ccVanPrice2: ccVanNum -= ccVanPrice2 ccVanPrice2 = ccVanPrice2 * 1.3 timer.wait_time = timer.wait_time - (timer.wait_time * 0.01) vanUpNum2 += 1 $Upgrades/Control/VanScroll/VanGrid/VanUp2/Price.text = str(ccVanPrice2) collectCupcakes() func _on_upgrades_condensed_cupcake_1(): if ccVanNum >= ccVanPrice3: ccVanNum -= ccVanPrice3 ccVanPrice3 = ccVanPrice3 * 1.3 ccVanValue += 1 vanUpNum3 += 1 $Upgrades/Control/VanScroll/VanGrid/VanUp3/Price.text = str(ccVanPrice3) collectCupcakes() #Chocolate func _on_upgrades_one_more_cupcake_2(): if ccChocNum >= ccChocPrice: ccChocSpawnRate += 1 ccChocNum -= ccChocPrice ccChocPrice = ccChocPrice * 1.3 chocUpNum1 += 1 $Upgrades/Control/ChocScroll/ChocGrid/ChocUp1/Price.text = str(ccChocPrice) collectCupcakes() func _on_upgrades_faster_cupcake_2(): if ccChocNum >= ccChocPrice2: ccChocNum -= ccChocPrice2 ccChocPrice2 = ccChocPrice2 * 1.3 timer.wait_time = timer.wait_time - (timer.wait_time * 0.01) chocUpNum2 += 1 $Upgrades/Control/ChocScroll/ChocGrid/ChocUp2/Price.text = str(ccChocPrice2) collectCupcakes() func _on_upgrades_condensed_cupcake_2(): if ccChocNum >= ccChocPrice3: ccChocNum -= ccChocPrice3 ccChocPrice3 = ccChocPrice3 * 1.3 ccChocValue += 1 chocUpNum3 += 1 $Upgrades/Control/ChocScroll/ChocGrid/ChocUp3/Price.text = str(ccChocPrice3) collectCupcakes() #Strawberry func _on_upgrades_one_more_cupcake_3(): if ccStrawNum >= ccStrawPrice: ccStrawSpawnRate += 1 ccStrawNum -= ccStrawPrice ccStrawPrice = ccStrawPrice * 1.3 strawUpNum1 += 1 $Upgrades/Control/StrawScroll/StrawGrid/StrawUp1/Price.text = str(ccStrawPrice) collectCupcakes() func _on_upgrades_faster_cupcake_3(): if ccStrawNum >= ccStrawPrice2: ccStrawNum -= ccStrawPrice2 ccStrawPrice2 = ccStrawPrice2 * 1.3 timer.wait_time = timer.wait_time - (timer.wait_time * 0.01) $Upgrades/Control/StrawScroll/StrawGrid/StrawUp2/Price.text = str(ccStrawPrice2) collectCupcakes() func _on_upgrades_condensed_cupcake_3(): if ccStrawNum >= ccStrawPrice3: ccStrawNum -= ccStrawPrice3 ccStrawPrice3 = ccStrawPrice3 * 1.3 ccStrawValue += 1 $Upgrades/Control/StrawScroll/StrawGrid/StrawUp3/Price.text = str(ccStrawPrice3) collectCupcakes() #Red Velvet func _on_upgrades_one_more_cupcake_4(): if ccChocNum >= ccChocPrice: ccChocSpawnRate += 1 ccChocNum -= ccChocPrice ccVanPrice = ccVanPrice * 1.3 $Upgrades/Control/VanScroll/VanGrid/VanUp1/Price.text = str(ccChocPrice) collectCupcakes() func _on_upgrades_faster_cupcake_4(): if ccChocNum >= ccChocPrice2: ccChocNum -= ccChocPrice2 ccChocPrice2 = ccChocPrice2 * 1.3 timer.wait_time = timer.wait_time - (timer.wait_time * 0.01) $Upgrades/Control/VanScroll/VanGrid/VanUp2/Price.text = str(ccChocPrice2) collectCupcakes() func _on_upgrades_condensed_cupcake_4(): if ccChocNum >= ccChocPrice3: ccChocNum -= ccChocPrice3 ccChocPrice3 = ccChocPrice3 * 1.3 ccChocValue += 1 $Upgrades/Control/ChocScroll/ChocGrid/ChocUp3/Price.text = str(ccChocPrice3) collectCupcakes() #Cinnamon func _on_upgrades_one_more_cupcake_5(): if ccChocNum >= ccChocPrice: ccChocSpawnRate += 1 ccChocNum -= ccChocPrice ccVanPrice = ccVanPrice * 1.3 $Upgrades/Control/VanScroll/VanGrid/VanUp1/Price.text = str(ccChocPrice) collectCupcakes() func _on_upgrades_faster_cupcake_5(): if ccChocNum >= ccChocPrice2: ccChocNum -= ccChocPrice2 ccChocPrice2 = ccChocPrice2 * 1.3 timer.wait_time = timer.wait_time - (timer.wait_time * 0.01) $Upgrades/Control/VanScroll/VanGrid/VanUp2/Price.text = str(ccChocPrice2) collectCupcakes() func _on_upgrades_condensed_cupcake_5(): if ccChocNum >= ccChocPrice3: ccChocNum -= ccChocPrice3 ccChocPrice3 = ccChocPrice3 * 1.3 ccChocValue += 1 $Upgrades/Control/ChocScroll/ChocGrid/ChocUp3/Price.text = str(ccChocPrice3) collectCupcakes() #Honest func _on_upgrades_condensed_cupcake_6(): if ccChocNum >= ccChocPrice: ccChocSpawnRate += 1 ccChocNum -= ccChocPrice ccVanPrice = ccVanPrice * 1.3 $Upgrades/Control/VanScroll/VanGrid/VanUp1/Price.text = str(ccChocPrice) collectCupcakes() func _on_upgrades_faster_cupcake_6(): if ccChocNum >= ccChocPrice2: ccChocNum -= ccChocPrice2 ccChocPrice2 = ccChocPrice2 * 1.3 timer.wait_time = timer.wait_time - (timer.wait_time * 0.01) $Upgrades/Control/VanScroll/VanGrid/VanUp2/Price.text = str(ccChocPrice2) collectCupcakes() func _on_upgrades_one_more_cupcake_6(): if ccChocNum >= ccChocPrice3: ccChocNum -= ccChocPrice3 ccChocPrice3 = ccChocPrice3 * 1.3 ccChocValue += 1 $Upgrades/Control/ChocScroll/ChocGrid/ChocUp3/Price.text = str(ccChocPrice3) collectCupcakes() func _on_upgrades_cupcake_damage(): pass func _on_upgrades_horse_health(): pass func _on_upgrades_sweetie_damage(): pass #Nightmare #Unlock func _on_upgrades_unlock_choc(): if ccVanNum >= ccVanPrice4: ccVanNum -= ccVanPrice4 ccChocLocked = false $"InGameUI/Main/HBoxContainer/Choc".visible = true $"InGameUI/Num/NumGrid/chocIcon".visible = true $"InGameUI/Num/NumGrid/ccChocNum".visible = true $"Upgrades/Control/VanScroll/VanGrid/VanUp4/Buy".visible = false func _on_upgrades_unlock_straw(): if ccChocNum >= ccChocPrice4: ccChocNum -= ccChocPrice4 ccStrawLocked = false $"InGameUI/Main/HBoxContainer/Straw".visible = true $"InGameUI/Num/NumGrid/strawIcon".visible = true $"InGameUI/Num/NumGrid/ccStrawNum".visible = true $"Upgrades/Control/ChocScroll/ChocGrid/ChocUp4/Buy".visible = false func _on_upgrades_unlock_r_vel(): if ccStrawNum >= ccStrawPrice4: ccStrawNum -= ccStrawPrice4 ccRVelLocked = false $"InGameUI/Main/HBoxContainer/Rvel".visible = true $"InGameUI/Num/NumGrid/rvelIcon".visible = true $"InGameUI/Num/NumGrid/ccRVelNum".visible = true $"Upgrades/Control/RVelScroll/RVelGrid/RVelUp4/Buy".visible = false func _on_upgrades_unlock_cin(): if ccRVelNum >= ccRVelPrice4: ccRVelNum -= ccRVelPrice4 ccCinLocked = false $"InGameUI/Main/HBoxContainer/Cin".visible = true $"InGameUI/Num/NumGrid/cinIcon".visible = true $"InGameUI/Num/NumGrid/ccCinNum".visible = true $"Upgrades/Control/CinScroll/CinGrid/CinUp4/Buy".visible = false func _on_upgrades_unlock_hon(): if ccCinNum >= ccCinPrice4: ccCinNum -= ccCinPrice4 ccHonLocked = false $"InGameUI/Main/HBoxContainer/Honest".visible = true $"InGameUI/Num/NumGrid/honIcon".visible = true $"InGameUI/Num/NumGrid/ccHonNum".visible = true $"Upgrades/Control/HonScroll/HonGrid/HonUp4/Buy".visible = false func _on_upgrades_unlock_nightmare(): if ccHonNum >= ccHonPrice4: ccHonNum -= ccHonPrice4 ccNightLocked = false $"InGameUI/Main/HBoxContainer/Night".visible = true $"InGameUI/Num/NumGrid/nightIcon".visible = true $"InGameUI/Num/NumGrid/ccNightNum".visible = true $"Upgrades/Control/NightScroll/NightGrid/NightUp4/Buy".visible = false #Collect func _on_van_cupcake_cc_van_collected(): ccVanNum += ccVanValue ccCount -= 1 collectCupcakes() func _on_choc_cupcake_cc_choc_collected(): ccChocNum += ccChocValue ccCount -= 1 collectCupcakes() func _on_straw_cupcake_cc_straw_collected(): ccStrawNum += ccStrawValue ccCount -= 1 collectCupcakes() func _on_rvel_cupcake_cc_rvel_collected(): ccRVelNum += ccRVelValue ccCount -= 1 collectCupcakes() func _on_cin_cupcake_cc_cin_collected(): ccCinNum += ccCinValue ccCount -= 1 collectCupcakes() func _on_honest_cupcake_cc_hon_collected(): ccHonNum += ccHonValue ccCount -= 1 collectCupcakes() func _on_night_cupcake_cc_night_collected(): ccHonNum += ccHonValue ccCount -= 1 collectCupcakes()