How do I create a laser beam

Get help using Construct 2

Post » Mon Jul 13, 2015 9:22 am

I am trying to create a laser beam that comes out of gun. But instead of it covering the whole width of the layout I want it to expand to the point where mouse pointer is currently at.
I am using
distance(player.X,player.Y,mouse.X,mouse.Y)


Works fine, but I want it to stop on a solid object which is in the way. So if pointer is behind the solid, the laser shouldn't cut through it, rather stop at the solid. So how can I achieve this?
B
4
Posts: 12
Reputation: 226

Post » Mon Jul 13, 2015 9:24 am

https://www.scirra.com/tutorials/902/lightning-fast-raycasting

I think this tutorial is what you are looking for.
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 944
Reputation: 12,210

Post » Mon Jul 13, 2015 10:47 am

simply. i think you must try to do this : when lazer beam collosin with solid > lazer destroy
B
52
S
18
G
10
Posts: 209
Reputation: 8,466

Post » Mon Jul 13, 2015 10:52 am

tunepunk wrote:https://www.scirra.com/tutorials/902/lightning-fast-raycasting

I think this tutorial is what you are looking for.


Besides this (great) tutorial there are actually multiple examples on this forum..
Typing laser in the search box and checking the topics should get you somewhere..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jul 13, 2015 10:54 am

No I don't want to destroy it either. I want it as a continuous flow.
B
4
Posts: 12
Reputation: 226


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Syazanie Amirin and 11 guests