Skip to content

Commit

Permalink
don't limit each player to one screenshot on Eval
Browse files Browse the repository at this point in the history
I had originally put the limit in place after observing too many novice players unwittingly saving screenshots to the MachineProfile, but things have changed since then.

Casual GameMode doesn't allow screenshots at all, and competitive players may very well want more than one screenshot of ScreenEvaluation now that there are multiple panes of information.

This commit also speeds up the ScreenShot animation.  4 seconds was too long; 1.5 feels better and is less likely to cause issues with a second screenshot being obscured by part of the first screenshot's animation(!).
  • Loading branch information
quietly-turning committed Sep 22, 2016
1 parent f6e818a commit 1947ee7
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions BGAnimations/ScreenEvaluation common/ScreenshotHandler.lua
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
if SL.Global.GameMode ~= "Casual" then

local player_that_screenshot_is_for = nil
local HasSavedScreenShot = { P1=false, P2=false }

return Def.Sprite{
InitCommand=cmd(draworder, 200),

CodeMessageCommand=function(self, params)
if params.Name == "Screenshot" and not HasSavedScreenShot[ToEnumShortString(params.PlayerNumber)] then
if params.Name == "Screenshot" then
-- organize Screenshots take using Simply Love into directories, like...
-- ./Screenshots/Simply_Love/2015/06-June/2015-06-05_121708.png
local prefix = "Simply_Love/" .. Year() .. "/"
prefix = prefix .. string.format("%02d", tostring(MonthOfYear()+1)) .. "-" .. THEME:GetString("Months", "Month"..MonthOfYear()+1) .. "/"

local success, path = SaveScreenshot(params.PlayerNumber, false, true, prefix)
if success then
-- only allow each player to save a screenshot once!
HasSavedScreenShot[ToEnumShortString(params.PlayerNumber)] = true
player_that_screenshot_is_for = params.PlayerNumber

MESSAGEMAN:Broadcast("ScreenshotCurrentScreen")
Expand All @@ -26,8 +23,8 @@ if SL.Global.GameMode ~= "Casual" then


AnimateScreenshotCommand=function(self)
-- (re)set these upon attempting to take a screenshot since we can potentially
-- reuse this same sprite for two screenshot animations (one for each player)
-- (re)set these upon attempting to take a screenshot since we can
-- reuse this same sprite for multiple screenshot animations
self:Center():zoomto(_screen.w, _screen.h)
self:SetTexture(SL.Global.ScreenshotTexture)

Expand All @@ -39,20 +36,19 @@ if SL.Global.GameMode ~= "Casual" then
self:effectcolor1(1,1,1,0)
self:effectcolor2(1,1,1,0.2)

-- sleep with it blinking in the center of the screen for 2 seconds
self:sleep(2)
-- sleep with it blinking in the center of the screen for 0.5 seconds
self:sleep(0.5)

if PROFILEMAN:IsPersistentProfile(player_that_screenshot_is_for) then
SM("Screenshot saved to " .. ToEnumShortString(player_that_screenshot_is_for) .. "'s Profile.")


-- tween to the player's bottom corner
local x_target = player_that_screenshot_is_for == PLAYER_1 and 20 or _screen.w-20
self:ease(2, 300):xy(x_target, _screen.h+10):zoom(0)
self:smooth(1):xy(x_target, _screen.h+10):zoom(0)
else
SM("Screenshot saved to Machine Profile.")
-- tween directly down
self:sleep(0.25)
self:ease(2, 300):y(_screen.h+10):zoom(0)
self:smooth(1):y(_screen.h+10):zoom(0)
end

player_that_screenshot_is_for = nil
Expand Down

0 comments on commit 1947ee7

Please sign in to comment.