I’m a bit new to 2D development, but I’m trying to put together a 2D platformer. I have a few situations where I’d like to have platforms that the player can walk through them from the side, but also jump on top of. The first example off the top of my head would be Super Mario 3 (Good example at 6:02):
No idea where I’d even begin with this. I should also mention that I’d like to add some sort of Pull / Push system to these as well, so I’d like to be able to have rigidbodies attached to them. Thank you if you can offer some guidance!
Installed one of clones of the game now. I didn’t test top jump carefully (last time I more thought about quake 3 gravity - it’s like on the moon), but now I have added two colliders (BoxCollider2d) to the test project and Unity doesn’t show an error after this. Need to set offset and size of each in inspector for: “Collider 2D components define the shape of a 2D GameObject for the purposes of physical collisions”.
In “Unity in action” there is a chapter about basic 2d platformer.
For optimization - if need - Unity 5 Game Optimization Chris Dickinson - best what I know about optimization.
@Treasureman “I have a few situations where I’d like to have platforms that the player can walk through them from the side, but also jump on top of.”
For this there exists Platform effector (for Physics2D):
You can build similar feature without it, but you’ll have to then control collision layers based on your character movement state / direction.
“I should also mention that I’d like to add some sort of Pull / Push system to these as well, so I’d like to be able to have rigidbodies attached to them”
You could detect if player presses button and collider is in range. You can detect this with one of many Physics2D commands, or using OnCollisionStay etc. And you’ll most likely have to make the rigidbody kinematic when you move it.