Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(3 edits)

You can code virtually any gameplay mechanic you want but I don’t think I’m capable of explaining it in simple terms/steps to someone who doesn’t really code.

Even disregarding the programming language, it all depends on how a specific mechanic works and the abstract steps you come up with in order to implement it.

In your case, the abstract steps would be something like this:

(1) Figure out the start angle for shooting the laser to the side of the current target.

(2) Rotate this angle in some direction with each game tick until it reaches a certain limit.

(3) Each time the angle changes, the laser needs to be physically shot using a raycast in the calculated direction of the current angle.

(4) Render the laser beam from the source to the hit point of a raycast as long as the attack is active.