Posted September 14, 2021 by Ove_frode
The player movement is different from the typical games. The first thing that has to implement is a rope system that will swing and stay connected. I will use the portal as my connection point for the rope. Once I have that working, the plan is to make the portal itself move in to make the timing of hitting space critical. Once I have them working the way, I would like ill implement a swing effect on the rope like a pendulum. After all of those steps are implemented, the plan is to work out a way to get the building blocks to spawn at the anchor point and the whole scene to move up. It is generating another block.
I need to make a way to stack the blocks up, giving them a fixedJoint2D, and if the player misses the tower, the block is to be destroyed. They lose a life, and if they hit the building but at a wrong angle, you might take a few more blocks with you, meaning the portal needs to be moved back to the spot of the top tower.
The control keys at this point are only the spacebar to drop the block.
Problems and fixes that have accrued
Following Skyoo tutorial on ropes and chains, I created the rope/chain that I am currently working with with a few of my additions.
(https://www.youtube.com/watch?v=XvS4U5Y0d4g)
After getting the arm/rope working, it was time to get the portal to move. Some of the problems that accrued in this step are:
Get the portal to move in a circular motion fixed by having the y axis moving on a Cos and the x-axis on a Sin so the portal.
After working out the circular motion, as shown above, I needed to have the rope move with the portal, which caused issues.
Then after some adjusting, I managed to get the rope/arm to stray with the portal, but as you might notice, the arm is not moving.
So to fix this, I wished to make the shoulder move at a -90 to 90-degree angle like a pendulum. So with the help of Ruzihm (https://gamedev.stackexchange.com/questions/75673/unity-falling-body-pendulum-behaviour/75748), I was able to use this code for the pendulum. I have yet to implement all the possibilities they mentioned in their answer, but I have managed to use this code to start the movement I desired.
I am currently working on having the block move with the hand (the white square) and spawn in the next block after the current one has been dropped and everything has moved up one square.