Laser Bolt suggestion?

Get help using Construct 2

Post » Wed Nov 20, 2013 4:22 am

Hi all,

I'm making a space shooter and I'm wondering if anyone has any ideas about creating a laser beam, not a continuous beam, but more like a very long laser bolt. As the bolt hits an object, the object would absorb the energy bolt. You'd see the bolt disappear behind it (absorbing its damage)..as if it were a line moving off screen.

I was thinking to maybe expand the width of the sprite as it leaves the player's weapon. Then on collision, to start shrinking the width, but it's not really working.

I'll post a capx soon, just looking for ideas...

Thanks!
B
97
S
32
G
16
Posts: 1,199
Reputation: 16,680

Post » Wed Nov 20, 2013 11:45 pm

You could use an instance variable for the lasers and tie that to the beam's width. Have an event check that variable and adjust the width accordingly.

Or use opacity: as the laser is absorbed, have it fade out until it's 0 and then destroy it.
B
16
S
6
G
2
Posts: 152
Reputation: 3,764

Post » Thu Nov 21, 2013 12:26 am

right.. so the targets are moving.. and if the beam is say 100 in length.. it can hit a target and start to shrink the width of the beam (as if absorbing it) but then if the target moves the new beam length would continue in a straigt path off screen to be destroyed..

cool thanks.. testing that out.
B
97
S
32
G
16
Posts: 1,199
Reputation: 16,680

Post » Thu Nov 21, 2013 12:33 am

@jobel

The collision with a target could trigger a timer for the laser, something that starts that shrinking process, and stop it if there's no collision.

I'll be curious to see how it turns out... keep us posted, will ya? ;)
B
16
S
6
G
2
Posts: 152
Reputation: 3,764

Post » Thu Nov 21, 2013 5:05 am

yes I'll post the capx here..

thanks!
B
97
S
32
G
16
Posts: 1,199
Reputation: 16,680

Post » Thu Nov 21, 2013 4:05 pm

@jobel,

Is this the sort of effect you're after? capx

There are a couple of different methods in there - I think option 2 is the best, but option 1 might work for you as well. (Made with R151)

This was a good distraction from finishing my project....

Colludium2013-11-21 16:07:43
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,208
Reputation: 43,838

Post » Thu Nov 21, 2013 7:24 pm

@Colludium that is fricken awesome!

I was not expecting something that looked so cool. I am going to have a look how you did that.czar2013-11-21 19:25:17
B
37
S
9
G
5
Posts: 437
Reputation: 6,094

Post » Thu Nov 21, 2013 7:31 pm

Nice code. Thanks for sharing.
B
37
S
9
G
5
Posts: 437
Reputation: 6,094

Post » Thu Nov 21, 2013 7:49 pm

@czar - thanks for the feedback!

I've added some comments to the capx so that it's a bit easier to figure out what I've done (I was in a rush when I created it earlier and the first version was a bit gash).

(edit - you see, I'm still not finishing my project....!)Colludium2013-11-21 19:50:28
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,208
Reputation: 43,838

Post » Thu Nov 21, 2013 8:59 pm

I'm not using the beta release, I'm on r146.. does C2 let you save the project as an earlier version? I'd love to see it.
B
97
S
32
G
16
Posts: 1,199
Reputation: 16,680

Next

Return to How do I....?

Who is online

Users browsing this forum: David181, OBLIVION and 62 guests