GameDevHQ 2.5D Cert Requirements Part 1
Objective: Create Modular Platform Prefab
Currently our Player can run and jump to grab the ledge. What would happen if we duplicate the platforms and moved them further? Would the Player still be able to grab the ledge and climb up? No. Why?
When we set up the position for the Player to grab the ledge and stand on top of the platform after climbing up, we moved the Player into the scene position and took that position and manually entered this into the ledge values. This is fine is you want to manaully set up each ledge and constantly take the values from where the Player should be during his animated state.
This isn’t the best option. Instead we can create some empty objects inside our Ledge Checker object and move these into the positions we would have manually set for the hanging hand position and the standing idle position after the climb up. To do this we will need to change a small bit of the Ledge script. We now will have GameObjects that set in the inspector to these empty HandPos and StandPos instead of the serialized Vector3 values that we manually set. We also have to change the values in the code from the Vector3 handPos/standPos to the new game objects transform.position.
This small change means now when we move the copies or other instances of the Prefab we can now make of the Platforms, the hand and stand positions will be pulled from their new positions instead of manually setting them each time.