Before I start with the Topic of Discussion, I wanted to quote an old project, or an old curiosity i had about collision.
while making a still unnamed flash game i had a major problem. once the attack animation started, the enemy would die. since the player and enemy were both made using 3DS max, there was a large invisible barrier around the enemy and player, making the collisions unrealisitc. i was thinking, very hard, when i remembered “Street Fighter 2”
in street fighter, there are attack collision boxes (red) and player collision boxes (blue). when the two interact, damage is assessed. they are invisible to the user, but play a big part in the fighting experience.
I am interested in the mechanics involving 2D games. This time, The good old-fashioned platformer. The sudden interest sparked when a collegue created a prototype in his 2D engine of choice, Clickteam’s Multimedia Fusion. Seeing that i am trying HARD not to continue with the serial engine-jumping, I opted to find out how I can create a similar experience using my current engine of choice (you guessed it) Unity:
Similar to the link in the quotations, characters can have more than one collision box, each box having a different function. I may be over thinking the process, and it may be much easier, but I have been brainstorming how to use the same type of theory on a platformer. Lets start with an example, everyone’s favorite portly plumber, mario:
In SMB, Mario’s First task is to jump over or on a goomba. If player decides to make mario jump on the goomba, the goomba dies.
How did that happen? in another 2d engine, Construct, there a set of conditions that can be used.
In relation to the ground:
- If the Y-coordinates on the player is higher than the Y-Coordinates on the enemy, and the two colliders meet, then the enemy is defeated.
- If the coordinates are the same, and the two meet, the the player is defeated.
It seems simple… in theory, but getting stumped when setting up that function may be inevitable.
An alternate way could be to use a damage collision box, and an attack collision box, similar to the quoted statement. the attack collider is not to exceed the damage collider, and placed on the feet:
- If the player’s attack collider hits the enemy’s collider, then the enemy is defeated.
- If the enemy’s collider touches the player’s damage collider, then the player is defeated.
With unity, you can use tags to tell what can/cannot be defeated by the attack collider. This could be an issue with the game having to deal with more processes, but it also gives more control over when and how the character gets hit.
I guess there is only one way to test my findings… more later.