2D Platformer Pick up and move object script help!

Hello there,

I am a first year games design student and we have been tasked with creating a 2D Platformer, I need help with a script in which the player will pick up and move a game object (in this case it is a boulder), I am unsure as to where to start with this?

We haven’t really touched on scripting yet on my course so apologies for my lack of knowledge on the subject at this present time.

I also need the ability to then drop and throw the boulder as well, taking information from which way the sprite is facing (left or right) and whether the sprite is jumping as well.

I believe that the way in which this will be done is I will have my player called ‘Player’ and the boulder called ‘Boulder’, when picked up the Boulder will inherit it’s location from the player but offset from the player sprite (for example: above the sprites head), meaning that the boulder will go where the player does and remains visible on screen, after that is set up then it would be adding in the drop feature and the throw feature, is this correct?

What you can do is when the player comes into contact with the boulder then you make the boulder a child of the player and so then it follows the player around. Additionally you could add an empty transform on the players head where you could attach the boulder on contact. Methods you should search for in the docs are transform.SetParent() and OnTriggerEnter()