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

SpawnPoints

This topic contains 3 replies, has 2 voices, and was last updated by  M. Akbar 3 years, 3 months ago.

  • August 19, 2017 at 8:40 pm #170784

    Hello,
    I’ve set the RespawnFollowsPlayerX=NO and created a couple of SpawnPoints in a level. Whenever the character dies, it will always get spawned from the first SpawnPoint even though the character died nearer to the second SpawnPoint.
    Any ideas on how to fix this?

  • August 19, 2017 at 8:57 pm #170785

    Additional info. The debug says:
    “restarting player based on closest spawn point to Player 2”

    Can I know how to configure so that it sets to Player 1 since it is one player mode?

  • August 19, 2017 at 9:06 pm #170786

    If its just a one player game, use an Empty Node named RespawnPlayer1 and make that a child of the camera. That’ll then follow the the player so it restarts where you’re at.

    Or you could tinker with the code slightly. In this snippet in the GameScene_Operations.swift file…

    else if (spawnArray.count > 0){
                        
                        print("restarting player based on closest spawn point to Player 2")
                        
                        startBackToLocation = getClosestSpawnLocationTo(thePlayer2)
                        startBackToLocation = CGPoint(x: startBackToLocation.x + 10, y: startBackToLocation.y)
                        
                    } 

    You could just change thePlayer2 to thePlayer.

    • August 19, 2017 at 9:24 pm #170789

      Hello Justin,
      I’ve tinkered with the code and it works.
      Thanks heaps 🙂

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