My Game uses a desert scenario, so you come accross dunes and grass and other minor abstacles. Since the time is limited on those "maps" I want the player to penalize if he moves over those objects be decreasing speed.
My Tiles are 32x32, and I created an Array based on a 4x4 Tileset.
When the Player moves I compare the current X Y to the Array and penalize his speed according to the value.
So on a Sand Tile its like
Code:
0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0
on a Dune tiles it looks like this:
Code:
0,0,0,0,0,0,0,1
0,0,0,0,0,1,1,0
0,1,0,0,1,2,1,0
0,1,1,2,3,2,0,0
0,0,2,3,3,2,1,0
0,1,2,2,2,1,0,0
0,2,1,1,0,0,0,0
1,0,0,0,0,0,0,0
0 = speed * 1
1 = speed * 0.75
2 = speed * 0.60
3 = speed * 0.40
Also when hit a 2 and 3 value field the character bumps 1 and 2 pixels up.
So far I see no speed issues at all with this.
I can disable it at runtime any time and see no difference.