Light source on projectiles?

0 favourites
  • 11 posts
From the Asset Store
Immerse your quiz games with our 6 unique music loops, ranging from acoustic chill guitar to cute and upbeat style.
  • 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.

    <img src="http://i.imgur.com/SpWwMqS.png" border="0" />

    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.

  • The thing you are searching for are the different Blend modes of the sprites

    You can find them under Effects bar

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • you are right i just experimented and nothing fits

    take a look

    here

  • 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.

  • 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

  • <img src="http://i.imgur.com/55YQuXQ.png" border="0" />

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

    Thanks for all your help :)

  • Cool

    I kinda needed that too for terrain blending

    Cheers

  • Wow nice effect, how did you acomplish it? :)

  • 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 :)

  • Okay, so after getting this working last night, I load up the game this morning and it still works. Then I decide I want to add in a second fire mode for the main character - mainly just to see if I can - and attach a light source to that as well. This all works, only if you fire for longer than a second or two all the lights stop appearing. This happens on both attacks, and they won't re-enable until you fire the other attack after waiting a bit.

    Is there a limit on how many sprites can be on screen at any given time? While they are super simple and don't cause any sort of performance hit, it's the only reason I can see for it to be doing this. Unless i've messed up something in my events log...which is probably just as likely really.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)