Okay, so after about two weeks of arduous trial-and-error, and the help of Poly and Spectre, I now have a sorta-good-maybe shadow engine for an untitled game that isn't Settle.
It looks like this.If you tear off its skin, it looks like this.{
//Draw Background
if surface_exists(global.sur_main)
{
surface_set_target(global.sur_main)
draw_background_tiled(par_croom.setback,0-view_xview[0],0-view_yview[0])
surface_reset_target()
}
//Draw Shadows
if surface_exists(global.sur_5)
{
surface_set_target(global.sur_5);
draw_set_color(make_color_rgb(237,239,199));
draw_rectangle(0,0,view_wview[0],view_hview[0],0);
draw_set_color(c_white);
surface_reset_target()
}
with par_light {
var me;
depth=19;
me=id;
if (instance_exists(par_hasshadow))
{
if surface_exists(global.sur_1)
{
surface_set_target(global.sur_1)
draw_set_color(c_white);
draw_rectangle(0,0,view_wview[0],view_hview[0],0);
with (par_hasshadow)
{
draw_sprite_ext(sprite_index,image_index,
(x-(me.x-x)/4)-view_xview[0],
(y-(me.y-y)/4)-view_yview[0],
image_xscale*1.25,
image_yscale*1.25,
image_angle,
c_black,
1);
}
}
surface_reset_target();
if surface_exists(global.sur_2)
{
surface_set_target(global.sur_2);
draw_set_color(c_white);
draw_rectangle(0,0,view_wview[0],view_hview[0],0);
draw_sprite(spr_light,0,x-view_xview[0],y-view_yview[0])
draw_set_blend_mode(bm_add);
draw_surface(global.sur_1,0,0);
draw_set_blend_mode(bm_normal);
}
surface_reset_target();
if surface_exists(global.sur_3)
{
surface_set_target(global.sur_3);
draw_set_color(c_white);
draw_rectangle(0,0,view_wview[0],view_hview[0],0);
draw_set_blend_mode(bm_subtract);
draw_surface(global.sur_2,0,0);
draw_set_blend_mode(bm_normal);
}
surface_reset_target();
if surface_exists(global.sur_main)
{
surface_set_target(global.sur_main);
draw_set_blend_mode(bm_subtract);
draw_surface(global.sur_3,0,0);
draw_set_blend_mode(bm_normal);
}
surface_reset_target();
if surface_exists(global.sur_5)
{
surface_set_target(global.sur_5);
draw_set_blend_mode(bm_subtract);
draw_sprite(spr_shadow,0,x-view_xview[0],y-view_yview[0]);
draw_set_blend_mode(bm_normal);
}
}
//Draw Objects with Shadows
with par_hasshadow {
surface_reset_target();
if surface_exists(global.sur_main)
{
surface_set_target(global.sur_main);
if instance_exists(par_light)
if point_distance(x,y,instance_nearest(x,y,par_light).x,instance_nearest(x,y,par_light).y) < 255
{
draw_sprite_ext(sprite_index,image_index,x-view_xview[0],y-view_yview[0],image_xscale,image_yscale,image_angle,
make_color_rgb(
255-point_distance(x,y,instance_nearest(x,y,par_light).x,instance_nearest(x,y,par_light).y),
255-point_distance(x,y,instance_nearest(x,y,par_light).x,instance_nearest(x,y,par_light).y),
255-point_distance(x,y,instance_nearest(x,y,par_light).x,instance_nearest(x,y,par_light).y)),
image_alpha)
}
else
draw_sprite_ext(sprite_index,image_index,x-view_xview[0],y-view_yview[0],image_xscale,image_yscale,image_angle,c_black,image_alpha)
}
}
//Draw Objects without Shadows
with par_noshadow {
surface_reset_target();
if surface_exists(global.sur_main)
{
surface_set_target(global.sur_main);
draw_sprite_ext(sprite_index,image_index,x-view_xview[0],y-view_yview[0],image_xscale,image_yscale,image_angle,c_white,image_alpha)
}
}
//Draw Foreground
if surface_exists(global.sur_main)
{
surface_set_target(global.sur_main);
draw_background_tiled(par_croom.setfore,0-view_xview[0],0-view_yview[0]);
surface_reset_target()
}
//Draw Shading
if surface_exists(global.sur_4)
{
surface_set_target(global.sur_4);
draw_set_color(c_black);
draw_rectangle(0,0,view_wview[0],view_hview[0],0);
draw_set_color(c_white);
surface_reset_target();
}
with par_shading {
surface_reset_target();
if surface_exists(global.sur_4)
{
surface_set_target(global.sur_4);
draw_sprite(sprite_index,image_index,x-view_xview[0],y-view_yview[0]);
}
}
//Draw Lights
with par_light{
surface_reset_target();
if surface_exists(global.sur_main)
{
surface_set_target(global.sur_main);
draw_set_blend_mode(bm_add);
draw_sprite_ext(spr_neglight,0,x-view_xview[0],y-view_yview[0],1,1,0,c_white,0.1);
draw_set_blend_mode(bm_normal);
}
}
//Draw EVERYTHING
surface_reset_target();
draw_surface_ext(global.sur_main,0,0,view_wport[0]/view_wview[0],view_hport[0]/view_hview[0],0,c_white,1);
draw_set_blend_mode(bm_subtract);
draw_surface_ext(global.sur_4,0,0,view_wport[0]/view_wview[0],view_hport[0]/view_hview[0],0,c_white,1);
draw_surface_ext(global.sur_5,0,0,view_wport[0]/view_wview[0],view_hport[0]/view_hview[0],0,c_white,0.8);
draw_set_blend_mode(bm_normal);
}
}
Yeah, that's the specific tag that I don't know what it is.
Edit: I now know what it is.Thanks, and no, I just always shade that way. If you mean the colors; I based all the artwork, so far, off of this new idea implanted into my brain that light casts warm colors and shadows are cold colors.I still haven't got around to shading in GM. Heh.
But this looks awesome and very non-obtrusive for a pixelated game.agrh thats awesome. I wanna make a horror game so bad, but that code looks like a fucking bother to deal with for shadows alone :(
Looks pretty sweet, bro.
stop saying bro
Anyhow, that lighting system looks like it could potentially add a lot to the atmosphere/scare factor. I'm definitely going torip it offdo something like it.Yep, this is excellent. I've always used transparency/w sprites to get certain effects.
But this will help greatly with the system I built for my The Worlds End killer.(Bro? Who says Bro? We're not bros here. If we where, I sure as hell didn't know.)Hokay, I got a video up, brohams.