Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Blending mode for this effect
#5
Hi guys,
I've done a quick prototype using the light effect in tilengine with BLEND_ADD mode. Here I use a shameless TimeSpinner screenshot rip-off for background, where I overlay a sprite with the halo. You can move the halo across the scren with the arrow keys (or the d-pad in the gamepad).

Here I attach the source code, the zipped assets folder and a preview. Enjoy!

Code:
#include "Tilengine.h"

static TLN_Bitmap background;
static TLN_Spriteset spriteset;

int main (int argc, char* argv[])
{
    int c, x = 176, y = 96;

    TLN_Init(400, 240, 1, 8, 0);
    TLN_SetLogLevel(TLN_LOG_ERRORS);  /* intoduced in release 2.1 */
    TLN_SetLoadPath("assets");

    background = TLN_LoadBitmap("TimeSpinner.png");
    TLN_SetBGBitmap(background);

    spriteset = TLN_LoadSpriteset("halo");
    TLN_ConfigSprite(0, spriteset, 0);
    TLN_SetSpriteBlendMode(0, BLEND_ADD, 0);

    TLN_CreateWindow(NULL, 0);
    while(TLN_ProcessWindow())
    {
        if (TLN_GetInput(INPUT_UP))
            y -= 1;
        else if (TLN_GetInput(INPUT_DOWN))
            y += 1;
        if (TLN_GetInput(INPUT_LEFT))
            x -= 1;
        else if (TLN_GetInput(INPUT_RIGHT))
            x += 1;
        TLN_SetSpritePosition(0, x, y);
        TLN_DrawFrame(0);
    }
    TLN_Deinit();

    return 0;
}


Attached Files Thumbnail(s)
   

.zip   assets.zip (Size: 17.41 KB / Downloads: 4)
Reply


Messages In This Thread
Blending mode for this effect - by JaumeAlcazo - 09-06-2018, 10:50 PM
RE: Blending mode for this effect - by megamarc - 09-07-2018, 06:36 AM
RE: Blending mode for this effect - by Domarius - 09-08-2018, 06:45 AM
RE: Blending mode for this effect - by megamarc - 09-08-2018, 08:27 AM
RE: Blending mode for this effect - by Domarius - 09-08-2018, 11:29 PM
RE: Blending mode for this effect - by megamarc - 09-11-2018, 07:25 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)