HelloPeople1 0 Newbie Poster

Hi guys
I'm making a top down shooter game using sprites. I have created all my game but one part, how the enemy shoots. Basically I was wondering how I could check if there was a wall sprite between my player sprite and my enemy sprite. This would be so that if there is a wall then the enemy would shoot, and if not then the enemy would not shoot. Ive already tried 2 ways which didn't work out too well. One was that i check the x and y position of the wall and if it was less then the players that meant there was a wall between the player and enemy. This didn't work because the program would think there were walls in places where there weren't actually. The second way was for the enemy to shoot invisible bullets and if an invisible bullet hit the player without hitting a wall then the enemy would shoot. This was a very inefficient way of doing it, and the game just didn't run well when i did it this way.


So any suggestions on how I could do this?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.