This causes undesirable behaviour such as if he jumps into another object he can jump higher because he's hit something which resets the jump counter.
I've thought about various ways to solve this and this is what I've come up with (in order of thought):
1. Use various points around the character and if the whole character hits something, perform a hittest on those objects and see which ones are colliding at the same point as the character is.

Advantages: Gives some indication of which part of character is colliding.
Disadvantages: if the character hits a spike or anything in the middle of himself, only the collision on the character will register and this may still cause undesirable effects.
2. Use four half-character hit tests to determine what quadrant he's hit. This is basically the same as above but with bigger hit test areas.

Advantages: Won't miss any spikes and a general area where he's been hit will always be generated.
Disadvantages: Still a lot of inaccuracy in the detection. This may be absolutely fine however.
3. Find the four tiles surrounding the character and put ONLY these into a bitmap. This will hugely improve the speed of the game running as it only has to load 4 tiles each frame for hit testing instead of 300 as it does currently.
Using these four tiles id numbers, identify them as slopes or solid ground etc, and use calculations to figure out where the character should be based on that.

Advantages: Very accurate and covers how the character should be angled upon the slope immediately.
Disadvantages: Will take a lot of coding and may not be possible in the scope of this game.
4. Again use the four tiles around the character, but this time identifying them as slopes or uneven/flat ground. Instead of calculating where the character will have to be when he lands, find out where his hands and feet need to be seperately and change his animation accordingly.

Advantages: Most realistic animation possible. [Excuse the incredibly bad paint image, didn't have much time!]
Disadvantages: Actually animating the character may be difficult. This may likely by alleviated by the fact the game is solely black and white.
I'm thinking at the moment that the most likely choices will be either number four or numbers 2 and 3 combined.
I've also been thinking about using verlet integration for the game, but right now I've got no idea how to understand what it is since American mathematics is written using so many symbols it means nothing to me!
0 comments:
Post a Comment