Light source on projectiles?

Get help using Construct 2

Post » Wed Feb 27, 2013 2:35 pm

Hey there guys,

I'm currently making a short game named Spaceship Superstars, and it's just a simple top down shooter game. I wanted to experiment a bit with darkness, so after a couple of tests I ended up making a sprite that was just pure black with a bit in the center erased, and pinned it to the player. This ends up giving me a sort of spotlight effect and works fine, but the player also fires out blue projectiles that I decided I want to have light attached to as well.



This is a shot showing what it looks like and showing one of the projectiles on screen fading into the shadow. I realise that in order to make it work as i'd like, I would presumably have to change the method i'm using to create the darkness at the moment. Unless I can do some trickery with layers that I don't know about yet, that is.

What I was thinking, and I have no idea if this is possible, would be to put some sort of ring of transparency around the bullet projectile that only affects one layer, making it so when it passes over the darkness it masks the area it's travelling over, but I don't know how to do this, or if it would end up affecting all the layers rather than just one.

I have no clue, really. TLDR; I want to make the bullets have a light source, is this possible?

Thanks for any help.
B
3
Posts: 9
Reputation: 468

Post » Wed Feb 27, 2013 2:52 pm

The thing you are searching for are the different Blend modes of the sprites
You can find them under Effects bar
B
12
S
3
G
1
Posts: 120
Reputation: 1,829

Post » Wed Feb 27, 2013 2:59 pm

I can't find anything in there that gives an object a light source of any kind. It's just blending options, distortion and colour effects.
B
3
Posts: 9
Reputation: 468

Post » Wed Feb 27, 2013 3:02 pm

you are right i just experimented and nothing fits
take a look
here
B
12
S
3
G
1
Posts: 120
Reputation: 1,829

Post » Wed Feb 27, 2013 3:16 pm

Ah thanks, i'm working towards something that's starting to work now :)

edit - I've managed to get bullets to sort of have a lightsource, but the firing pattern is a little random so sometimes the light goes in a different direction to the bullets...frustrating. 5ifty2wo2013-02-27 15:25:49
B
3
Posts: 9
Reputation: 468

Post » Wed Feb 27, 2013 4:47 pm

OK i got it
I opened Blend Modes project from example directory
It didnt worked for me because the upper layer Force Own Texture was No by default. If Yes it does work
B
12
S
3
G
1
Posts: 120
Reputation: 1,829

Post » Wed Feb 27, 2013 4:50 pm



I managed to get it working just a couple of minutes ago too haha.

Thanks for all your help :)
B
3
Posts: 9
Reputation: 468

Post » Wed Feb 27, 2013 5:00 pm

Cool
I kinda needed that too for terrain blending
Cheers
B
12
S
3
G
1
Posts: 120
Reputation: 1,829

Post » Wed Feb 27, 2013 6:35 pm

Wow nice effect, how did you acomplish it? :)
B
34
S
4
G
5
Posts: 84
Reputation: 4,835

Post » Wed Feb 27, 2013 9:56 pm

I made a new layer above the main game one, and made it black rather than transparent. Then created a new sprite on the same layer, which was just a white circle, set the blend mode to "Destination Out", and then made follow the player - That's how his lighting works.

The projectiles are sorta the same thing. Each time the mouse is clicked, it starts shooting bullets with a slight spread. So I made a smaller white circle on the "Lights" layer, set it to "Destination Out" and set an event for whenever a bullet was created, it would create this light ontop of it. This worked, but the light source stayed in a straight line while the bullets would veer off at different angles.

Then I made it so that every tick, the smaller light had it's position set to the bullet, and this worked. I don't know very much about programming at all so there might be a better way and it was a lot of trial and error but it works :)
B
3
Posts: 9
Reputation: 468

Next

Return to How do I....?

Who is online

Users browsing this forum: R0J0hound and 26 guests