Loading draw/spaceinvaders/spaceinvaders.go +17 −10 Original line number Diff line number Diff line Loading @@ -561,17 +561,9 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size fill = draw.FillFromRGBA(colorMap[xQ]) } if yQ == 5 { if hasArm(invader, squares, xQ) { fill = draw.FillFromRGBA(colorMap[xQ]) } } if yQ == 4 || yQ == 6 { if hasArmExtension(invader, squares, xQ, yQ) { if hasArmOrExtension(invader, squares, xQ, yQ) { fill = draw.FillFromRGBA(colorMap[xQ]) } } if yQ == 5 { // clean eye from arm extension if eye, c := hasEye4(invader, colorMap, colors, xQ); eye { Loading Loading @@ -674,6 +666,21 @@ func hasEyeOrAnthena(invader invader, highBodyIndex *int, squares, xQ, yQ int) ( return } func hasArmOrExtension(invader invader, squares, xQ, yQ int) (result bool) { if yQ == 5 { if hasArm(invader, squares, xQ) { result = true } } if yQ == 4 || yQ == 6 { if hasArmExtension(invader, squares, xQ, yQ) { result = true } } return } func hasArmOrExtension2(invader invader, lowBodyIndex, squares, xQ, yQ int) (result bool) { if hasArm2(invader, squares, xQ, yQ) { result = true Loading Loading
draw/spaceinvaders/spaceinvaders.go +17 −10 Original line number Diff line number Diff line Loading @@ -561,17 +561,9 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size fill = draw.FillFromRGBA(colorMap[xQ]) } if yQ == 5 { if hasArm(invader, squares, xQ) { fill = draw.FillFromRGBA(colorMap[xQ]) } } if yQ == 4 || yQ == 6 { if hasArmExtension(invader, squares, xQ, yQ) { if hasArmOrExtension(invader, squares, xQ, yQ) { fill = draw.FillFromRGBA(colorMap[xQ]) } } if yQ == 5 { // clean eye from arm extension if eye, c := hasEye4(invader, colorMap, colors, xQ); eye { Loading Loading @@ -674,6 +666,21 @@ func hasEyeOrAnthena(invader invader, highBodyIndex *int, squares, xQ, yQ int) ( return } func hasArmOrExtension(invader invader, squares, xQ, yQ int) (result bool) { if yQ == 5 { if hasArm(invader, squares, xQ) { result = true } } if yQ == 4 || yQ == 6 { if hasArmExtension(invader, squares, xQ, yQ) { result = true } } return } func hasArmOrExtension2(invader invader, lowBodyIndex, squares, xQ, yQ int) (result bool) { if hasArm2(invader, squares, xQ, yQ) { result = true Loading