09-08-2018, 08:27 AM
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!
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;
}