This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Noodle's profile picture

Multiplayer Game Help

Started by Noodle, 24 April 2012 - 07:01 PM
Noodle #1
Posted 24 April 2012 - 09:01 PM
I am making a gmae for Noodle-SH but I need help for multiplayer.
I have a sprite which is "o" (soon to be changed).

I need to be able to draw a new sprite when someone connects to an ID of the computer.
Example:
term.clear()
term.setCursorPos(1,1)
local currentX = 25
local currentY = 9
local sprite = "o"
write "Type the id you would like to join: "
local c = read()

-- Now for the movements
if event == key and key == "w" -- ik.. the id's, but im at school
currentY = currentY - 1
rednet.send(c, "up")
end

-- Receive code
id, msg = rednet.receive()
if id == c and msg == "up" then -- THE C IS ALSO ON THE OTHER COMPUTER TO JOIN SOMEONE ELSE IP - IP (Connecting)
(OtherOBJECT) currentY = (OtherOBJECT) currentY - 1
end
Noodle #2
Posted 24 April 2012 - 10:31 PM
Nvm fixed xD
When event: Join - Happens it makes new sprite at the spawn location.
Noodle #3
Posted 24 April 2012 - 10:44 PM
Hmm.. Can anyone help with
loading a sprite?
sprite2.currentx ??
ComputerCraftFan11 #4
Posted 25 April 2012 - 03:18 AM
Instead of doing rednet.recieve
Try:

if event == "rednet_messege" then

To recieve and move at the same time
Noodle #5
Posted 25 April 2012 - 03:22 AM
Where to put this?

http://www.computercraft.info/forums2/index.php?/topic/1429-cant-update-coords/page__fromsearch__1
there is the new code i have made… Currently need help