• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Trying to figure out how to program hitscan in Gamemaker

G

geg

Guest
Hi! I'm still figuring out some of the basics of gamemaker, and I wanted to ask if anybody knew of a way to program hitscan into a game. Specifically, I'd like to know how to ensure it only scans certain objects. For example, it would stop if it hit a wall first, but deal damage if it hit an enemy first. Any and all help is appreciated!
 

samspade

Member
You're probably looking for something like a collision line.

Loop through all instances within a certain range using the with statement, check the angle (if you want) and check whether there is something like a wall between them. If not, they're hit.
 
Top