1
0
mirror of https://github.com/LDDestroier/CC/ synced 2024-10-31 23:26:19 +00:00

Update tron

This commit is contained in:
LDDestroier 2018-11-16 15:52:36 -05:00 committed by GitHub
parent 81e6eaaa07
commit 0fd157f1bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

6
tron
View File

@ -299,6 +299,7 @@ end
local deadGuys = {} local deadGuys = {}
local trail = {} local trail = {}
local lastTrails = {} local lastTrails = {}
isPuttingDown = false
local putTrailXY = function(x, y, p) local putTrailXY = function(x, y, p)
trail[y] = trail[y] or {} trail[y] = trail[y] or {}
@ -695,6 +696,7 @@ end
local sendInfo = function(gameID) local sendInfo = function(gameID)
transmit(port, { transmit(port, {
player = isHost and player or nil, player = isHost and player or nil,
putTrail = isPuttingDown,
gameID = gameID, gameID = gameID,
keysDown = isHost and nil or keysDown, keysDown = isHost and nil or keysDown,
trail = isHost and lastTrails or nil, trail = isHost and lastTrails or nil,
@ -801,10 +803,11 @@ local game = function()
if isHost then if isHost then
setDirection(p, nil, control[lastDirectionPressed]) setDirection(p, nil, control[lastDirectionPressed])
setDirection(np, nil, control[netLastDirectionPressed]) setDirection(np, nil, control[netLastDirectionPressed])
p.putTrail = not keysDown[control.release]
else else
setDirection(p, nil, control[lastDirectionPressed]) setDirection(p, nil, control[lastDirectionPressed])
isPuttingDown = not keysDown[control.release]
end end
p.putTrail = not keysDown[control.release]
if keysDown[control.lookLeft] then if keysDown[control.lookLeft] then
scrollAdjX = scrollAdjX - 2 scrollAdjX = scrollAdjX - 2
@ -885,6 +888,7 @@ local networking = function()
elseif type(msg.keysDown) == "table" then elseif type(msg.keysDown) == "table" then
netKeysDown = msg.keysDown netKeysDown = msg.keysDown
netLastDirectionPressed = msg.lastDir netLastDirectionPressed = msg.lastDir
player[nou].putTrail = msg.putTrail
end end
end end