Xtreme
11-21-2000, 08:45 AM
I wanted to know how i could do enemy detection in my games.
i am programming a tile game by having the main character check the tile he is on based on an array such as
1 1 1 1 2 2 2 2 1 1 1
1 1 1 1 2 2 2 2 1 1 3
1 1 2 2 3 3 3 1 1 2 3
well my first thought would be to have the enemies run through the same algorithm. i was just wondering if there was a better way?
Here is a longer definition. first i load a text file like the one above into a two dimensional array. then i lay the tiles on the screen. when i move say right i move my character and use an algorithm to detect which part of the array i am in. after that i check the number in the array, if it is say a 2 i move the character back. well i want moving people that i could punch around a little bit or even talk to but i need to know how to set that up. i was thinking on having the other character have a tempororay storage variable that would store his location in the map and if when the main character moved his place in the map and it was the same as the temporary variable of the other character an interacter would occur. is this sound logic or is there a better way?
i am programming a tile game by having the main character check the tile he is on based on an array such as
1 1 1 1 2 2 2 2 1 1 1
1 1 1 1 2 2 2 2 1 1 3
1 1 2 2 3 3 3 1 1 2 3
well my first thought would be to have the enemies run through the same algorithm. i was just wondering if there was a better way?
Here is a longer definition. first i load a text file like the one above into a two dimensional array. then i lay the tiles on the screen. when i move say right i move my character and use an algorithm to detect which part of the array i am in. after that i check the number in the array, if it is say a 2 i move the character back. well i want moving people that i could punch around a little bit or even talk to but i need to know how to set that up. i was thinking on having the other character have a tempororay storage variable that would store his location in the map and if when the main character moved his place in the map and it was the same as the temporary variable of the other character an interacter would occur. is this sound logic or is there a better way?