local vignette = 0 local size = 0 local pox = 0 local poy = 0 local mod = 0 local vigmod = 0 local oldv = 0 local tempv = 0 local dead = 0 local hurt_sprite = nil --this image must exist for your sprite to use as a HUD overlay local hurt_i = LoadImage("scriptbank\\images\\hud\\hurt.png") function vignette_damage_init(e) HideHuds() --hides the default HUDS (such as health etc) vignette = 4 --starting value of the vignette (if you adjust this you will want to adjust the image size and position) size = 490 --adjusts how big the sprite is pox = -196 --adjusts the position of the sprite poy = -198 mod = 2.75 --how quickly the sprite changes vigmod = 0.2 --how quickly the vignette changes oldv = 0 tempv = 0 dead = 0 end function vignette_damage_main(e) if hurt_sprite == nil then vignette_damage_init(e) hurt_sprite = CreateSprite(hurt_i) SetSpriteSize(hurt_sprite,size,size) SetSpritePosition(hurt_sprite,2000,2000) SetPostVignetteIntensity(vignette) oldv = g_PlayerHealth-1 else if g_PlayerHealth <= g_gameloop_StartHealth then tempv = g_PlayerHealth if tempv ~= oldv then if tempv < oldv then vignette = vignette + vigmod size = size - mod if size < 1 then size = 1 end pox = pox + (mod/2) poy = poy + (mod/2) oldv = oldv - 1 elseif tempv > oldv then vignette = vignette - vigmod size = size + mod pox = pox - (mod/2) poy = poy - (mod/2) oldv = oldv + 1 end SetPostVignetteIntensity(vignette) SetSpriteSize(hurt_sprite,size,size) end end PasteSpritePosition(hurt_sprite,pox,poy) if g_PlayerHealth < 1 then dead = 1 elseif dead == 1 then vignette_damage_init(e) oldv = g_PlayerHealth-1 end end end function vignette_damage_exit(e) SetPostVignetteIntensity(0) end