2005-01-29
[開発ログ]サッカーゲーム
とりあえず ER のクライアントとして暫定的に書き始める。 オブジェクトの生成に関してはだいたいこれでいいだろう。 あとは当たり判定とか、移動処理をもっと深く考えないと。
@er = ER.new 'localhost', 9999 @screen = ER::Screen.new @er, nil, 640, 400 BALL_POSS = [[0,0,0]] GOAL_POSS = [[0,0,-200], [0,0,-200]] MAN_POSS = [ [-100,0,-100], [ 0,0,-100], [ 100,0,-100], [-100,0, 100], [ 0,0, 100], [ 100,0, 100], ] @balls = [] @goals = [] @mans = [] BALL_POSS.each do |pos| ball = Ball.new @er ball.position = 0,0,0 @balls << ball @screen.add_obj ball end GOAL_POSS.each do |pos| goal = Goal.new @er goal.position = 0,0,0 @goals << goal @screen.add_obj goal end MAN_POSS.each do |pos| man = Man.new @er man.position = pos man.start_autorun @mans << man @screen.add_obj man end @balls[0].a = [0,-1,0] @balls[0].v = [0,10,0] 600.times do @screen.loop_proc (@balls + @mans).each do |o| o.local_proc end @goals.each do |o| if o.hit? @balls[0] end end @er.sync end