# How do I create a reflective beam?

0 favourites
• 5 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
• I'd like to create a continuous beam that would be reflected off certain surfaces, think a laser reflecting off a mirror. I'm fairly inexperienced and most of the things I've found even sort of regarding this are for construct 2, I don't know how much of a difference it makes. Any help would be appreciated, thank you!

• Most things that worked in C2 will work fine in C3

I'm picturing 3 objects

1. Laserhead (invisible sprite)

2. Lasertrail (tiled BG)

3. Reflective Surface (Sprite)

Have the lasertrail and the laserhead in a container, so that each time a laserhead is created, a lasertrail is made along with it

Then just continuously set the angle and width of the lasertrail to the laserhead

Each time a laserhead collides with a reflective surface, you can spawn another laserhead and set it's angle to the inverse of whatever the first laserhead's angle was

Should be enough to get started. Let me know if you need more detail!

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Most things that worked in C2 will work fine in C3

I'm picturing 3 objects

1. Laserhead (invisible sprite)

2. Lasertrail (tiled BG)

3. Reflective Surface (Sprite)

Have the lasertrail and the laserhead in a container, so that each time a laserhead is created, a lasertrail is made along with it

Then just continuously set the angle and width of the lasertrail to the laserhead

Each time a laserhead collides with a reflective surface, you can spawn another laserhead and set it's angle to the inverse of whatever the first laserhead's angle was

Should be enough to get started. Let me know if you need more detail!

Thank you for your help! I tried it and could use some more detail. Like How does the laserhead work? Like does it have bullet behavior or is it stationary like a pre defined path for the lasertrail. Also I had trouble in terms of setting the width of the lasertrail to the laserhead. I only know how to make the laser trail the same width as the laserhead, but I don't know how to set the the width to the laserhead, i.e. the width spanning from where it spawned to its current location (assuming that's what you're telling me to do, I hope I'm not misunderstanding?)

Thanks again, sorry if I'm dumb.

• > Most things that worked in C2 will work fine in C3

>

>

>

> I'm picturing 3 objects

> 1. Laserhead (invisible sprite)

> 2. Lasertrail (tiled BG)

> 3. Reflective Surface (Sprite)

>

> Have the lasertrail and the laserhead in a container, so that each time a laserhead is created, a lasertrail is made along with it

>

> Then just continuously set the angle and width of the lasertrail to the laserhead

>

> Each time a laserhead collides with a reflective surface, you can spawn another laserhead and set it's angle to the inverse of whatever the first laserhead's angle was

>

> Should be enough to get started. Let me know if you need more detail!

Thank you for your help! I tried it and could use some more detail. Like How does the laserhead work? Like does it have bullet behavior or is it stationary like a pre defined path for the lasertrail. Also I had trouble in terms of setting the width of the lasertrail to the laserhead. I only know how to make the laser trail the same width as the laserhead, but I don't know how to set the the width to the laserhead, i.e. the width spanning from where it spawned to its current location (assuming that's what you're telling me to do, I hope I'm not misunderstanding?)

Thanks again, sorry if I'm dumb.

Yeah I was picturing the laserhead moving via bullet behavior

For setting the width of the lasertrail, there is a handy expression you can use called distance() which calculates the distance between 2 locations. You can use it to set the width of the trail to the distance between the trail's origin all the way to wherever the head is

No problem! Any more questions, feel free to ask

• 5 posts