hyperPad hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login
    1. Home
    2. Hamed
    3. Posts
    • Profile
    • Following 1
    • Followers 11
    • Topics 6
    • Posts 443
    • Best 71
    • Controversial 0
    • Groups 2

    Posts made by Hamed

    • In App Purchase Tutorial on Exported Projects

      In App purchase swift code for exported projects:

      first add pod 'SwiftyStoreKit' to the list of pods in Podfile in a text editor.

      Then in terminal, run pod install. If you don't have cocoapods installed on your mac, follow the instructions here: https://guides.cocoapods.org/using/getting-started.html

      Replace the contents of HPSwift.swift with the following file

      //
      //  HPSwift.swift
      //  hyperPad-Project
      //
      //  Created by Hamed Saadat on 2019-08-07.
      //
      
      import Foundation
      import SwiftyStoreKit
      
      @objc class HPSwift: NSObject {
          fileprivate var _behaviours: HPBehaviours? = nil
          @objc var behaviours: HPBehaviours? {
              get {
                  return _behaviours
              }
              
              set(behaviours) {
                  _behaviours = behaviours
                  
                  SwiftyStoreKit.completeTransactions(atomically: true) { purchases in
                      for purchase in purchases {
                          switch purchase.transaction.transactionState {
                          case .purchased, .restored:
                              if purchase.needsFinishTransaction {
                                  // Deliver content from server, then:
                                  SwiftyStoreKit.finishTransaction(purchase.transaction)
                              }
                              // Unlock content
                              behaviours?.broadcastValue(purchase.productId as NSString, withKey: "purchaseComplete")
                              
                          case .failed, .purchasing, .deferred:
                              behaviours?.broadcastValue(purchase.productId as NSString, withKey: "purchaseError")
                              break // do nothing
                          @unknown default:
                              break
                          }
                      }
                  }
                  
                  behaviours?.addReceiveKey("restorePurchases", onReceive: { (receiveValue) in
                      SwiftyStoreKit.restorePurchases(atomically: true) { results in
                          if results.restoreFailedPurchases.count > 0 {
                              behaviours?.broadcastValue("Restore Failed: \(results.restoreFailedPurchases)" as NSString, withKey: "purchaseError")
                          }
                          else if results.restoredPurchases.count > 0 {
                              results.restoredPurchases.forEach { (purchase) in
                                  behaviours?.broadcastValue(purchase.productId as NSString, withKey: "purchaseComplete")
                              }
                          }
                          else {
                              print("Nothing to Restore")
                          }
                      }
                  })
                  
                  /*
                   Add Behaviour functionality here
                  */
                  
                  behaviours?.addReceiveKey("purchase", onReceive: { (recieveValue) in
                       // handle in app purchase logic! //
                          SwiftyStoreKit.purchaseProduct("INSERT_PURCHASE_IDENTIFIER_HERE_OR_USE_recieveValue", quantity: 1, atomically: true) { result in
                              switch result {
                              case .success(let purchase):
                                  behaviours?.broadcastValue(purchase.productId as NSString, withKey: "purchaseComplete")
                              case .error(let error):
                                  var message = ""
                                  switch error.code {
                                  case .unknown: message = "Unknown error. Please contact support"
                                  case .clientInvalid: message = "Not allowed to make the payment"
                                  case .paymentCancelled: break
                                  case .paymentInvalid: message = "The purchase identifier was invalid"
                                  case .paymentNotAllowed: message = "The device is not allowed to make the payment"
                                  case .storeProductNotAvailable: message = "The product is not available in the current storefront"
                                  case .cloudServicePermissionDenied: message = "Access to cloud service information is not allowed"
                                  case .cloudServiceNetworkConnectionFailed: message = "Could not connect to the network"
                                  case .cloudServiceRevoked: message = "User has revoked permission to use this cloud service"
                                  default: message = ((error as NSError).localizedDescription)
                                  }
                                  behaviours?.broadcastValue(message as NSString, withKey: "purchaseFailed")
                              }
                          }
                  })
              }
          }
          
      }
      

      Some key points:

      behaviours?.addReceiveKey("restorePurchases", onReceive: { (receiveValue) in
                      // add your code here
                  })
      

      Will get triggered when you trigger a broadcast behaviour with the restorePurchases key

      behaviours?.broadcastValue(purchase.productId as NSString, withKey: "purchaseComplete")

      Will trigger a receive message behaviour with the purchaseComplete key

      INSERT_PURCHASE_IDENTIFIER_HERE_OR_USE_recieveValue can be replaced with either the identifier of your purchase from AppStoreConnect. OR the receiveValue parameter. If you use receiveValue make sure in your broadcast behaviour, you're sending the identifier from App Store Connect.

      posted in Help and Support
      HamedH
      Hamed
    • RE: Apple is asking me some questions about my game

      @SplitMindGaming answer no to the rest

      posted in Help and Support
      HamedH
      Hamed
    • RE: Apple is asking me some questions about my game

      Answer Yes

      Pretty much just usage data, diagnostics, and crash data. Even though you don't actively use those, we do have 3rd party libraries that are included part of the build. (we're not tracking anything but firebase analytics is available to use if you want it)

      posted in Help and Support
      HamedH
      Hamed
    • RE: Cant Open Xcode Project

      @SplitMindGaming those are warnings and can be ignored. Can you screenshot filtering by red errors?

      Also are you using an M1 Machine?

      posted in Help and Support
      HamedH
      Hamed
    • RE: Problem testing game in viewer app

      @CreativeCloud can you try logging out and logging back in?

      posted in Help and Support
      HamedH
      Hamed
    • RE: Plugins in hyperPad! (UNOFFICIAL)

      @RobinsonX this is wild good job

      posted in WIP and Showcase
      HamedH
      Hamed
    • RE: Bad Update!

      @Dave007 ASAP! There are a bunch of bugs that were brought up on the discord server that we're going through as well

      posted in Bug Reports
      HamedH
      Hamed
    • RE: 1.26 Scale breaks physics

      @TutorialDoctor this is intentional. This is because hyperPad doesn't have a soft body physics engine i.e malleable shapes.

      What is actually happening when you scale an object is that it will destroy the body and re-creates it when its done scaling.

      When you destroy a body, the joints go with it :(

      posted in Bug Reports
      HamedH
      Hamed
    • RE: hyperPad 1.26 is here!

      @Dave007 we will be submitting a hotfix update as soon as possible.

      posted in Announcements
      HamedH
      Hamed
    • RE: Set and return absolute position of music tracks

      @bosswave said in Set and return absolute position of music tracks:

      n a music track’s absolute position from the Play Music behavior?
      Mostly, I believe this would be great for slo-mo segments. I know Set Tim

      Get Music settings was a bug. Fixed in the latest update that is being released soon!

      posted in Comments & Feedback
      HamedH
      Hamed
    • RE: hyperPad 1.26 Beta

      Yeah he meant @SplitMindGaming Sorry

      posted in Announcements
      HamedH
      Hamed
    • RE: hyperPad 1.26 Beta

      @Kamdroid No because there are still some experimental things that some of the key fixes depend on. Unfortunately, needs to be part of the same build :(

      posted in Announcements
      HamedH
      Hamed
    • RE: hyperPad 1.26 Beta

      @SplitMindGaming we didn't change anything with set Flip, but we did make changes to Animate behaviour. Could that be it?

      posted in Announcements
      HamedH
      Hamed
    • RE: hyperPad 1.26 Beta

      Hello friends new beta should be up

      posted in Announcements
      HamedH
      Hamed
    • RE: hyperPad 1.26 Beta

      @RobinsonX yes. How it works is you create a “render texture” behaviour. And a draw behaviour where you can draw primitive shapes or stamp an image from a load image behaviour. Then there is an option to choose from a list of effects (shaders)

      Render texture can also be chained with other render textures so you can cascade effects

      @Kamdroid yes. We can add string manipulation behaviours not in this beta but the next one sure.

      posted in Announcements
      HamedH
      Hamed
    • RE: Quick Feedback and suggestion.

      Here is a post on how to do in app purchases with code on the the discord chat:

      https://discordapp.com/channels/597171608301338625/598196611063087145/638047615224774676

      posted in Comments & Feedback
      HamedH
      Hamed
    • RE: Thrusterpunch (WIP)

      Have we released masks? Because I'm trying to figure out how you did this!

      posted in WIP and Showcase
      HamedH
      Hamed
    • RE: Object rotation issues

      @bosswave said in Object rotation issues:

      Upon closer inspection, it seems it might actually only be an issue when an object is being affected by the “propel object” behavior.

      @bosswave we fixed an issue recently where if the screen is rotated, it was breaking propel object behaviour.

      We might have not taken care of all cases. Can you make a simple project of what you're trying to do and send it to us so I can see if its broken?

      posted in Bug Reports
      HamedH
      Hamed