I am trying to make an endless runner/platformer with a monkey as the main character. The X axis is a rope that the monkey can both run on top of as well as hang from the bottom of the rope while avoiding obstacles. I am not sure how I would write this script(C#) to do so.
Key:
Brown rectangle = monkey
Black rectangle = Rope
Green Block = obstacle
Yellow block = powerup/banana
These are obviously just placeholders, but I want to be able to flip the monkey onto both sides of the rope. Spacebar is the key I would like to use in order to make the monkey switch from running to hanging. Up arrow is the key I would like to use in order to jump, and down arrow is the key I would like to use in order to swing underneath the obstacles that are hanging from the rope.
Any input would be greatly appreciated and I will take all the help I can get!
Thank you everyone in advance for your help and time!
I think the rope could be a very long one way platform, this way you can drop from it and fall when pressing spacebar; look for one way platform, edge collider and platform effector 2D.
About the hanging, the easiest way I can think, is to fake it. Just put an invisible collider below the rope, when your monkey drops from the rope, it lands on this collider which works like an invisible floor and let the monkey walk and fake the hanging.
I ain’t really an expert but you coul try this.
to flip it upside down
transform.localScale =newVector3(1,-1,1);
to flip it sprite back the way it was
transform.localScale =newVector3(1,1,1);
I haven’t tested it, but I think it can be done in Vector3.
Negative localScale is the way to go for flipping the sprite. Then of course you also need to change the y position of the sprite so it is under the rope instead of over: