Recently I experimented with an easy way to make lined shapes glow (using LÖVE of course). There are of course other ways of doing it, and there are many styles of glow that can be used, but this is the one I came up with.
love.graphics.setColor(r, g, b, 15) for i = 7, 2, -1 do if i == 2 then i = 1 love.graphics.setColor(r, g, b, 255) end love.graphics.setLineWidth(i) -- draw lined shape here end
The shape gets drawn multiple times, each time with a different line width, set by
i. In all, six shapes are drawn with the widths 7, 6, 5, 4, 3, 1. For all the lines, except the last, the alpha of the colour (by the way,
b represent the respective values of whatever colour you might choose) is set to 15. Since the alpha of every overlapping colour is added to each other (by default), for each line the colour will get stronger and stronger, giving the glow effect. The last line is given an alpha of 255, since this is where all the "light" is meant to be coming from.
Because there was some interest in a part 3, of this series, I've written it, and in this part we'll cover creating bounds that the camera can't move beyond. Make sure you've read part 1 and part 2 before continuing.
In case you're wondering what I mean by this, I mean restricting the movement of the camera to a "box", as in, having minimum and maximum x/y coordinates for the camera. This comes in handy when you're following players, for example, and you don't want the camera to show any of the stuff beyond the level (usually blackness) when the player comes to an edge. Now of course, movement bounding can get much more complicated than a simple rectangle, you restrict it to certain paths and the like, but we're going to keep it simple here.Read more
In this post I'm going to be showing you origins when drawing stuff in Love2D. First of all, what are origins? They specify the offset for the origin of the object's x/y coordinates. In other words, if you specify the x origin to be 20, the object will be drawn 20 pixels to the left, as in x - 20. It's the same for the y origin: if we have a y origin of 20, the object will be drawn 20 pixels up, as in y - 20.
This allows us to do many useful things. First of all, if we have an object with centre based coordinates (like physical bodies), instead of drawing like this:Read more
In part 1 we constructed a basic camera. Now we're going to extend it by adding some parallax scrolling. Note that the method I'll use is probably not the prettiest, as I came up with it in half an hour. Nevertheless, this will be a starting point for you to develop your own system.
Now, for those who don't know, what is parallax scrolling? It's a way to get a pseudo-3D effect while still have all graphics and gameplay based in 2D. It's currently used very widely among 2D games, as it adds a sense of depth that normally isn't there.Read more
This is the first of a couple of blogs on creating cameras in the LÖVE engine. This part will deal with the fundamentals of creating a camera. Part two will deal with parallax scrolling and creating layers. So, let's get to it!
Update: I've actually ended up writing a part 3, which covers restricting camera movement.Read more