SFML - Is there a way to implement lights?

Started by
11 comments, last by frob 10 years, 2 months ago

Well, this is what I have done:

It's nothing amazing, but ignoring it, I was looking for a way to implement a small light on every bullet, first because the bullets can't be seen very well, but I don't want to use sprites for these... Is there a way to do that? I've been trying the sf::BlendMode::Add, but idk how does that exactly work sad.png.

Advertisement

You could use a vertex array that stores each bullet as a vertex and make each vertex the color you want it to be. The sf::Points type only lets them be one pixel, though.

As well you can create your own drawable class.

http://www.sfml-dev.org/tutorials/2.0/graphics-vertex-array.php

Check out my journal on the subject here I'm using SFML and a light library someone else developed. I'm not doing anything special with it, but it can do some cool things.

Here's a journal entry with a video of using it.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

Let me add, you can also do something much simpler, which is create a larger "layer" of all white for your glow around your bullets, and then do blendmode on it

Like this (see the player with glowing armor, and glowing bullets):

enemies1.png

Here's a link describing creating the glow image.

See my blog entry here detailing the code to do this. You can find gimp tutorials on how to create the fuzzy white outlines for the glow effects.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

Let me add, you can also do something much simpler, which is create a larger "layer" of all white for your glow around your bullets, and then do blendmode on it

Like this (see the player with glowing armor, and glowing bullets):

enemies1.png

Here's a link describing creating the glow image.

See my blog entry here detailing the code to do this. You can find gimp tutorials on how to create the fuzzy white outlines for the glow effects.

Great work with that, thanks!

For lighting, I use a matrix of black pixels with different transparency values and draw them on top of my image. Depending on the lighting in that area, the transparency is changed.

Cheers :)!

I'm a game programmer and computer science ninja !

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here !

For lighting, I use a matrix of black pixels with different transparency values and draw them on top of my image. Depending on the lighting in that area, the transparency is changed.

Cheers smile.png!

Hmm, that sounds simpler, the problem is that every bullet is a mini-circle, it has the same color all over it, I try it, but I can't see any difference, lol

Here's a link describing how to do make the glow around your objects.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

Here's a link describing how to do make the glow around your objects.

Begginer question here, does gimp have a way to paint all the silhouette white?

Edit: Solved, but i think my gimp have a bug, when i apply the DoG all the layer gets transparent, what the..

This topic is closed to new replies.

Advertisement