public void Initialize() { v_window = new Spartacus.Forms.Window("Spartacus Pong", 800, 600); v_racket_left = new Spartacus.Game.Object("RL", 20, (v_window.v_height - 100) / 2, 20, 100); v_racket_left.AddImage("racket.png"); v_racket_right = new Spartacus.Game.Object("RR", v_window.v_width - 40, (v_window.v_height - 100) / 2, 20, 100); v_racket_right.AddImage("racket.png"); v_ball = new Spartacus.Game.Object("B", v_window.v_width / 2, v_window.v_height / 2, 15, 15); v_ball.AddImage("ball.png"); v_ball_x = 10; v_ball_y = 10; v_bound_up = new Spartacus.Game.Object("BU", 0, 0, v_window.v_width, 10); v_bound_down = new Spartacus.Game.Object("BD", 0, v_window.v_height - 10, v_window.v_width, 10); v_bound_left = new Spartacus.Game.Object("BL", 0, 0, 10, v_window.v_height); v_bound_right = new Spartacus.Game.Object("BR", v_window.v_width - 10, 0, 10, v_window.v_height); v_score_left = new Spartacus.Game.Text(80, 10, "Courier New", 14, 255, 255, 255, 255); v_score_left.SetMessage("0"); v_score_right = new Spartacus.Game.Text(v_window.v_width - 100, 10, "Courier New", 14, 255, 255, 255, 255); v_score_right.SetMessage("0"); v_text_paused = new Spartacus.Game.Text((v_window.v_width - 50) / 2, 10, "Courier New", 14, 255, 255, 255, 255); v_text_paused.SetMessage(""); v_paused = false; v_layer = new Spartacus.Game.Layer(); v_layer.AddObject(v_racket_left); v_layer.AddObject(v_racket_right); v_layer.AddObject(v_ball); v_layer.AddObject(v_bound_up); v_layer.AddObject(v_bound_down); v_layer.AddObject(v_bound_left); v_layer.AddObject(v_bound_right); v_layer.AddText(v_score_left); v_layer.AddText(v_score_right); v_layer.AddText(v_text_paused); v_layer.Collision += this.OnCollision; v_keyboard = new Spartacus.Game.Keyboard(v_window); v_keyboard.KeyDown += this.OnKeyDown; v_keyboard.KeyPress += this.OnKeyPress; v_keyboard.Start(60); v_level = new Spartacus.Game.Level(v_window); v_level.AddLayer(v_layer); v_level.Time += this.OnTime; v_level.Start(30); v_window.Run(); }
public void Initialize() { this.v_window = new Spartacus.Forms.Window("Spartacus OverLord", this.v_window_width, this.v_window_height); this.v_database = new Spartacus.Database.Sqlite("overlord.db"); MapGenerator v_generator = new MapGenerator(); this.v_tileset = v_generator.Generate( this.v_database, this.v_map_size, this.v_tile_size, this.v_tree_chance, "and name like 'jungle%'", "and name not like 'autumn%'" ); this.v_player = "green"; this.v_playercolor = System.Drawing.Color.Green; this.v_soldiers = new Soldier[4]; this.v_soldiers[0] = new Soldier( this.v_database, TeamColor.GREEN, "green_1", 2, 3 ); this.v_soldiers[1] = new Soldier( this.v_database, TeamColor.GREEN, "green_2", 2, 4 ); this.v_soldiers[2] = new Soldier( this.v_database, TeamColor.RED, "red_1", 6, 1 ); this.v_soldiers[3] = new Soldier( this.v_database, TeamColor.BLUE, "blue_1", 1, 6 ); this.v_selected = -1; this.v_action = ""; this.v_turn = TeamColor.GREEN; this.v_range = new Range(this.v_tileset, this.v_map_size, this.v_mapview_width, this.v_mapview_height); this.v_soldiersview = new Spartacus.Game.Layer(); this.v_soldiersview.MouseClick += this.OnSoldierMouseClick; this.v_soldiersview.Collision += this.OnCollision; this.v_mapview = new Spartacus.Game.Layer(); this.v_mapview.MouseClick += this.OnMapMouseClick; this.v_mapview.Collision += this.OnCollision; this.BuildMapView(); this.v_guiview = new Spartacus.Game.Layer(); this.v_guiview.MouseClick += this.OnGuiMouseClick; this.v_guiview.Collision += this.OnCollision; this.BuidGuiView(); this.v_keyboard = new Spartacus.Game.Keyboard(this.v_window); this.v_keyboard.KeyDown += this.OnKeyDown; this.v_keyboard.Start(15); this.v_level = new Spartacus.Game.Level(this.v_window); this.v_level.AddLayer(this.v_mapview); this.v_level.AddLayer(this.v_soldiersview); this.v_level.AddLayer(this.v_guiview); v_level.Time += this.OnTime; this.v_level.Start(15); this.v_window.Run(); }