This commit is contained in:
Jeena Paradies 2011-04-13 17:52:09 +02:00
parent 31240b02b8
commit 0c340f95d2
6 changed files with 1193 additions and 1188 deletions

View file

@ -17,18 +17,12 @@ class PongBot
@send_start = false
@ggs_network = GGSNetwork.new(self)
#@ggs_network.connect("10.42.43.1")
@ggs_network.connect()
end
def ggsNetworkReady(ggs_network, ready)
@ggs_network.sendCommand("ready")
t = Thread.new {
loop do
gameTick()
sleep 0.3
end
}
end
def ggsNetworkDefined(ggs_network, defined)
@ -56,7 +50,6 @@ class PongBot
@send_start = true
end
else
puts "#{@ball.y}:#{@me.y}"
if @ball.y < @me.y - 5
@ggs_network.sendCommand("up")
elsif @ball.y > @me.y - 5
@ -71,6 +64,13 @@ class PongBot
else
@me = @player2
end
Thread.new {
loop do
gameTick()
sleep 0.3
end
}
end
def ball(pos_s)
@ -88,7 +88,6 @@ class PongBot
def game(wait_or_start)
if wait_or_start == "wait"
puts "Other ready"
else
@game_paused = false
end