The Carcinus Lurker is an enemy from Next Encounter. It shoots a laser in a sweeping motion from left to right and you're supposed to jump over it or duck under it. I did bring back the enemy, but never got that sweeping motion down, so it just shoots towards the player, even though the animation still does the sweeping motion. I was just wondering if that's possible.
Viewing post in Serious Sam: The Sequel (Public Beta) comments
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.