The O.G. Virtual learning! Buy one, get 2 more Lifetime Memberships! - Click Here!

Portal Issue

This topic contains 3 replies, has 2 voices, and was last updated by  Keith Davis 3 years, 6 months ago.

  • November 29, 2017 at 6:05 pm #176741

    I enter a portal, collect some armor. The display shows the correct amount. When I enter another portal to go back, I loose the armor and the display shows the armor that I had before I first entered the portal. This is all within the same level. It is a shop where you can buy things like extra armor. When you buy armor you get XPs and that count holds fine when exiting.

  • November 30, 2017 at 3:43 pm #176779

    This is my fix:

    I saved the armor points to defaults in GameScene_Inventory.swift around line 499 I added:

    func addToArmor(amount:Int) {

    currentArmor = currentArmor + amount

    if (currentArmor >= thePlayer.armor){

    currentArmor = thePlayer.armor

    // Saving armor points that were missing after
    // leaving a portal – KRD 11/29/17
    defaults.set(currentArmor, forKey: “CurrentArmor”)


  • November 30, 2017 at 3:59 pm #176781

    Yeah, thats perfectly fine. You’re doing more micro-upgrades to the stats, which is totally cool. The way I envisioned player class upgrades was more macro, for lack of a better term. Like the player would buy new armor (thus changing their look with new art) and along with that, the Stats dictionary in the class dictionary would be changed as well.

    So for example, the kit has a Class called Peasant which the player begins with. If the player went into a shop, they could upgrade to PeasantWithArmor, so they’d walk out with that class. Which is what persists from level to level.

    But what you’re doing is fine too.

    You might want to create your own Swift file called GameScene_Keith.swift And put your custom code in there. Just add…

    import Foundation
    import SpriteKit
    extension GameScene  {

    To the top of the file, and it will be an extension of the GameScene. Keeps all your customizations in one place.

  • November 30, 2017 at 4:02 pm #176783

    Thanks for the feedback!

You must be logged in to reply to this topic.

Know what an affiliate program is? You make money just by sharing links to our site! Win. Win.

Earn when you refer any buyer here! 30 day tracking. Commissions are 33%-50% and recur on subscription products!

Uh oh, missing your affiliate ID. Create one real quick