diff options
| author | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2016-02-02 14:32:09 -0500 |
|---|---|---|
| committer | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2016-02-02 14:32:09 -0500 |
| commit | c6c3443b42920e57eb822e7c160139bf17cc0955 (patch) | |
| tree | edc590125873e993e92eb9f14b788f1d91aeee75 /gamemode/hud | |
| parent | 41342f0b0fd915ddeebe9ba783faab9446037c2e (diff) | |
| download | wintersurvival2-c6c3443b42920e57eb822e7c160139bf17cc0955.tar.gz wintersurvival2-c6c3443b42920e57eb822e7c160139bf17cc0955.tar.bz2 wintersurvival2-c6c3443b42920e57eb822e7c160139bf17cc0955.zip | |
Fixed connectthedots minigame, game is now finished
Diffstat (limited to 'gamemode/hud')
| -rw-r--r-- | gamemode/hud/games/connectthedots.lua | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/gamemode/hud/games/connectthedots.lua b/gamemode/hud/games/connectthedots.lua index c5aea2a..b0cdaf9 100644 --- a/gamemode/hud/games/connectthedots.lua +++ b/gamemode/hud/games/connectthedots.lua @@ -154,31 +154,40 @@ Game.AddRegDot = function(spelltab) --Pick a random distance from this dot to the screen edge, and put a dot there, but at least 20 pixels local rand = 0 - local totop = fd[1]+20 - local toleft = fd[0]+20 - local tobot = ScrH() - totop - 40 - local toright = ScrW() - toleft - 40 + local totop = fd[1] + local toleft = fd[0] + local tobot = ScrH() - totop + local toright = ScrW() - toleft --If we're in the first quadrent if(position > 0 and position <= 90) then --pick a distnce between us and the closer edge local closer = math.min(totop,toright) + print("Closer edge is " .. closer) rand = math.random(20,closer) elseif(position > 90 and position <= 180) then local closer = math.min(totop,toleft) + print("Closer edge is " .. closer) rand = math.random(20,closer) elseif(position > 180 and position <= 270) then local closer = math.min(toleft,tobot) + print("Closer edge is " .. closer) rand = math.random(20,closer) else local closer = math.min(tobot,toright) + print("Closer edge is " .. closer) rand = math.random(20,closer) end print("And at a distance of " .. rand) - - local xpos = (math.cos(position)*rand) - local ypos = (math.sin(position)*rand) + local cosmul = math.cos(math.rad(position)) + --Remember that screens are funny, with 0,0 in the UPPER left hand corner, this tricked me up for the longest time... + local sinmul = -math.sin(math.rad(position)) + print("Cosine mul is " .. cosmul) + print("Sine mul is " .. sinmul) + + local xpos = (cosmul*rand)+fd[0] + local ypos = (sinmul*rand)+fd[1] print("I think I should add a dot at " .. xpos .. "," .. ypos) local newdot = {} |
