private void updateGameObjectFromsceneData(int scene, GameObj go, SceneObject so) { if (so.Type == Constants.ROAD_BLOCK_T) { go.SpriteName = "road_block"; base.ObjectManager.AddGameObject(go, so.Lane); int offset = lastScreenOffset; go.UpdatePosition(so.X + offset, LanePositionY[so.Lane] - go.W / 2); } else if (so.Type == Constants.BARRICADE) { go.SpriteName = "barricade"; base.ObjectManager.AddGameObject(go, so.Lane); int offset = lastScreenOffset; go.UpdatePosition(so.X + offset, LanePositionY[so.Lane] - go.W / 2); } }
public override void ScreenBecomesCurrent() { freeGameObjects.Clear(); gameObjects.Clear(); for (int i = 0; i < roadObjects.Length; i++) { roadObjects[i] = new GameObj(); roadObjects[i].SpriteName = "road"; base.ObjectManager.AddGameObject(roadObjects[i], Constants.ROAD); roadObjects[i].UpdatePosition(roadObjects[i].W / 2 + i * roadObjects[i].W, 480 - roadObjects[i].H/2 - 100); } skateObj = new Skater(); skateObj.Lane = Constants.LANE_F_F; base.ObjectManager.AddGameObject(skateObj, skateObj.Lane); int roadTopEdge = (int) roadObjects[0].Position.Y - roadObjects[0].H/2 - skateObj.H/2 + 20; LanePositionY.Add(Constants.LANE_M_B, 270); LanePositionY.Add(Constants.LANE_M_F, 290); int roadBottomEdge = (int)roadObjects[0].Position.Y + roadObjects[0].H / 2 - skateObj.H/2 + 10; LanePositionY.Add(Constants.LANE_F_B, 315); LanePositionY.Add(Constants.LANE_F_F, 340); skateObj.UpdatePosition(100, LanePositionY[skateObj.ZOrder] - skateObj.H/2); speedBar = new GameObj { SpriteName = "speed" }; speedKnob = new GameObj { SpriteName = "knob" }; base.ObjectManager.AddScreenObject(speedBar); speedBar.UpdatePosition(200, game.Graphics.PreferredBackBufferHeight - speedBar.H - 10); base.ObjectManager.AddScreenObject(speedKnob); speedKnob.UpdatePosition(50, speedBar.Position.Y); skateObj.Shadow = new GameObj { SpriteName = "boy_shadow" }; base.ObjectManager.AddGameObject(skateObj.Shadow, Constants.ON_ROAD); skateObj.syncShadowPosition(); LoadMap(); }