From 8a4169653fd3c5568e69b7c657f394366ccdcf93 Mon Sep 17 00:00:00 2001 From: jgk Date: Wed, 24 Feb 2021 04:51:08 +0100 Subject: [PATCH] Improve visuals --- src/Dodge/Weapons.hs | 35 +++++++++++++++-------------------- src/Dodge/WorldActions.hs | 24 +++++++++++++----------- 2 files changed, 28 insertions(+), 31 deletions(-) diff --git a/src/Dodge/Weapons.hs b/src/Dodge/Weapons.hs index e35ac0ddc..f8bf4b531 100644 --- a/src/Dodge/Weapons.hs +++ b/src/Dodge/Weapons.hs @@ -1020,7 +1020,7 @@ moveFlame rotd w pt = ((:) $ Flaming (div time 10) sp p ep) hiteff = _btHitEffect' pt pt thepic p' = pictures $ reverse [ pic p' , piu p' , pi2 p' , glow p' ] - pic p' = onLayerL [levLayer UPtLayer,6] $ uncurry translate (prot3 p') + pic p' = setLayer 2 $ onLayerL [levLayer UPtLayer,6] $ uncurry translate (prot3 p') $ rotate (pi * 0.5 + argV rotd) $ scale scaleChange 1 -- $ color white @@ -1030,7 +1030,7 @@ moveFlame rotd w pt = ] -- $ rotate (radToDeg (fromIntegral time * 10)) -- $ polygon [(-5,-2),(5,-2),(5,2),(-5,2)] - pi2 p' = onLayerL [levLayer UPtLayer,4] $ uncurry translate (prot p') + pi2 p' = setLayer 2 $ onLayerL [levLayer UPtLayer,4] $ uncurry translate (prot p') -- $ rotate ( (fromIntegral time * 5)) $ rotate (pi * 0.5 + argV rotd) -- $ color (mixColors 0.5 0.5 orange white) @@ -1658,7 +1658,7 @@ moveLaser phaseV pos dir mcid w pt Just (p,E3x2 wl) -> createSpark 8 colID (p +.+ safeNormalizeV (sp -.- p)) (reflectDir wl) Nothing _ -> id - pic = pictures [ fadeLine sp (head ps) 0.5 40 yellow + pic = pictures [ fadeLine sp (head ps) 0.2 40 yellow , setLayer 2 $ color (withAlpha 0.9 white) $ vThickLine (sp:ps) , setLayer 2 $ color (withAlpha 0.5 yellow) $ vvThickLine (sp:ps) ] @@ -1681,22 +1681,17 @@ moveLaser phaseV pos dir mcid w pt -- op = lp +.+ 50 *.* normalizeV (lp -.- lp') fadeLine :: Point2 -> Point2 -> Float -> Float -> Color -> Picture -fadeLine sp ep alph width col = setLayer 2 $ color yellow $ - polygon [sp +.+ n - ,sp - ,sp -.- n - ,ep -.- n - ,ep - ,ep +.+ n - ] --- polygonCol [(sp +.+ n, col) --- ,(sp , col) --- ,(sp -.- n, col) --- ,(ep -.- n, col) --- ,(ep , col) --- ,(ep +.+ n, withAlpha 0 col) --- ] - where n = width *.* (normalizeV $ normV $ ep -.- sp) +fadeLine sp ep alph width col = setLayer 2 $ + polygonCol [(sp , ca) + ,(sp +.+ n , cb) + ,(ep +.+ n , cb) + ,(ep , ca) + ,(ep -.- n , cb) + ,(sp -.- n , cb) + ] + where n = width *.* (normalizeV $ vNormal $ ep -.- sp) + ca = withAlpha alph col + cb = withAlpha 0 col -- pictures [color (withAlpha (0.8 * alph) col) $ lineOfThickness width [sp,p 0.25] -- ,color (withAlpha (0.6 * alph) col) $ lineOfThickness width [p 0.25,p 0.5] -- ,color (withAlpha (0.4 * alph) col) $ lineOfThickness width [p 0.5,p 0.75] @@ -2076,7 +2071,7 @@ moveTeslaArc p d i w = $ set randGen g $ createSpark 8 nc q2 (argV sv + d1) Nothing $ foldr damCrs w hitCrs - where pic = pictures + where pic = setLayer 2 $ pictures [ onLayer PtLayer $ color (f2 nc) $ line ps' , onLayer UPtLayer $ color (withAlpha 0.02 cyan) $ lineOfThickness 20 ps' , onLayer UPtLayer $ color (withAlpha 0.02 cyan) $ lineOfThickness 25 ps' diff --git a/src/Dodge/WorldActions.hs b/src/Dodge/WorldActions.hs index e12308194..d023d0cf7 100644 --- a/src/Dodge/WorldActions.hs +++ b/src/Dodge/WorldActions.hs @@ -595,28 +595,30 @@ mvGenBullet' w bt wth = _btWidth' bt t = _btTimer' bt -bulLine :: Color -> Float -> [Point2] -> Drawing -bulLine _ _ [] = blank -bulLine _ _ (x:[]) = blank -bulLine col width (a:b:[]) -- (a:b:[]) - = onLayer HPtLayer $ pictures +bulLine c w = setLayer 2 . bulLinea c w + +bulLinea :: Color -> Float -> [Point2] -> Picture +bulLinea _ _ [] = blank +bulLinea _ _ (x:[]) = blank +bulLinea col width (a:b:[]) -- (a:b:[]) + = onLayer HPtLayer $ pictures $ reverse [polygonCol $ zip (wedgeGeom width b a) $ [white,withAlpha 0 white,withAlpha 0 white] ,polygonCol $ zip (lineGeom (width+1.5) a b) $ [col,col,withAlpha 0 col,withAlpha 0 col] ] -bulLine col width (a:b:c:[]) -- (a:b:[]) - = onLayer HPtLayer $ pictures +bulLinea col width (a:b:c:[]) -- (a:b:[]) + = onLayer HPtLayer $ pictures $ reverse [polygonCol $ zip (wedgeGeom width b a) $ repeat white ,polygonCol $ zip (wedgeGeom width b c) $ [white,white,withAlpha 0 white] ,polygonCol $ zip (lineGeom (width+1.5) a c) $ [col,col,withAlpha 0 col,withAlpha 0 col] ] -bulLine col width (a:b:_:c:[]) -- (a:b:[]) - = onLayer HPtLayer $ pictures +bulLinea col width (a:b:_:c:[]) -- (a:b:[]) + = onLayer HPtLayer $ pictures $ reverse [polygonCol $ zip (wedgeGeom width b a) $ repeat white ,polygonCol $ zip (wedgeGeom width b c) $ [white,white,withAlpha 0 white] ,polygonCol $ zip (lineGeom (width+1.5) a c) $ [col,col,withAlpha 0 col,withAlpha 0 col] ] -bulLine col width (a:b:_:_:c:_) -- (a:b:[]) - = onLayer HPtLayer $ pictures +bulLinea col width (a:b:_:_:c:_) -- (a:b:[]) + = onLayer HPtLayer $ pictures $ reverse [polygonCol $ zip (wedgeGeom width b a) $ repeat white ,polygonCol $ zip (wedgeGeom width b c) $ [white,white,withAlpha 0 white] ,polygonCol $ zip (lineGeom (width+1.5) a c) $ [col,col,withAlpha 0 col,withAlpha 0 col]