Created
July 18, 2012 18:32
-
-
Save Sephi-Chan/3137942 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(sector). | |
-export([ start/0, loop/1 ]). | |
-record(ship, { x, y }). | |
start() -> | |
io:format("Hello world!~n"), | |
Ship = #ship{ x = 1, y = 2 }, | |
OtherShip = #ship{ x = 2, y = 2 }, | |
Ships = [ Ship, OtherShip ], | |
spawn(?MODULE, loop, [ Ships ]). | |
loop(Ships) -> | |
io:format("Args ~w ~n", [ Ships ]), | |
receive | |
{ PlayerPid, move, { X, Y } } -> | |
io:format("Move command.~n"), | |
loop(Ships); | |
_ -> | |
io:format("Other.~n"), | |
loop(Ships) | |
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(player). | |
-export([ start/1, loop/1 ]). | |
start(Name) -> | |
spawn(?MODULE, loop, [ Name ]). | |
loop(Argz) -> | |
io:format("Loop argz ~w. ~n", [ Argz ]), | |
receive | |
_ -> | |
io:format("Other.~n"), | |
loop(Argz) | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment