# Laser Ray

Get help using Construct 2

### » Sat May 25, 2013 7:23 pm

Here a Picture of my problem and my informations and questions:
informations: Fly is my player, TiledBackground 2 is the right side of the window, where you have to touch to shoot.
I want to create a laser ray.
Do i have to apply physics to the laser as well? every other object has physics behaviour. Don't know how to do it with the Length of the Laser and the reflection with TiledBackground 3 ( The Wall )

Thank you!
B
3
S
1
Posts: 32
Reputation: 391

### » Sat May 25, 2013 8:51 pm

Hi @Desory,

Not sure exactly what you are trying to achieve, so this may not be the correct answer for you! But have you tried using the bullet behaviour for your laser.

Using this behaviour would allow you to control the deflection angle which is shown in your event sheet. It would also give you control over the lasers movement and speed.

Hope this information helps Blacksmith2013-05-25 20:52:15
B
32
S
6
G
7
Posts: 487
Reputation: 8,193

### » Sat May 25, 2013 10:23 pm

At first i would like to thank you for the quick answer.
Is bullet compatible with physics?
B
3
S
1
Posts: 32
Reputation: 391

### » Sat May 25, 2013 10:58 pm

Just make a tiled object and setup this width and height to increase every 0.1 second, for example.

On Arcade have a sample of use, also, coming with C2 have another sample.
B
92
S
18
G
12
Posts: 1,166
Reputation: 18,090

### » Sun May 26, 2013 2:11 pm

Nice thanks most of it works, but now:
Problem 1: The width of the Laser increases proportionate.
Idea 1: Setting the position every 0.1 seconds to Fly.ImagepointX(0) and the same with Y doesn't really solve it.
Problem2: The Laser does not reflect on collision with the Wall (TiledBackground 3)
Idea 2: Tried playing around with Imagepoints of the Laser, but does not really work because i cannot say "IF Imagepoint 2 [Right side of the laser] collides with wall" its only possible with "IF laser collides with wall" which would take the origin.
Do i have to play around with Variables?

Edit: I know ANGLE is not really what i should use with a Laser, but dont know what I could use instead.Desory2013-05-26 14:13:17
B
3
S
1
Posts: 32
Reputation: 391

### » Sun May 26, 2013 4:06 pm

The laser itself does not need a physics system.
Here is a capx with the basic idea. Just need to fine tune the points for laser spawn. If you want the laser to be the same color after the bounce, you can use the same image for the sprites laser and laser2.

https://www.dropbox.com/s/fisr74oqdmuywya/laser%20idea.capx
B
23
S
10
G
10
Posts: 96
Reputation: 6,452

### » Sun May 26, 2013 8:15 pm

https://www.dropbox.com/s/3cyd0btsi8mh7mz/FS1.rar
pw: capxfortests
only this once i will allow you to look into my construct :D its horrible and not properly done , thats why i didnt upload it until now :D
but i hope you can help me.. it does not work like yours do...
B
3
S
1
Posts: 32
Reputation: 391

### » Sun May 26, 2013 9:03 pm

Thanks for posting the capx. I went over it, and made a few changes to the laser systems.

Here are the changes I made

FS1.capx

Hopefully this helps. By the way, where did you get the sprites? they look pretty cool
B
23
S
10
G
10
Posts: 96
Reputation: 6,452

### » Mon May 27, 2013 5:59 am

http://opengameart.org/
you can freely use any sprite just be aware of the conditions, some creators want their name called in the credits
thanks very much i will look into it when i get home and post an answer then :)
B
3
S
1
Posts: 32
Reputation: 391