public virtual void Add(GameObject obj, int x, int y) { GameWorld.Add(obj); grid[x, y] = obj.Id; obj.Parent = this; obj.Position = new Vector2(x * cellWidth, y * cellHeight); }
public override void Add(GameObject obj, int x, int y) { GameWorld.Add(obj); grid[x, y] = obj.Id; obj.Parent = this; obj.Position = AnchorPosition(x, y); }
//setup skill public void Setup() { GameWorld.Add(this); OverlayManager overlay = GameWorld.GetObject("overlay") as OverlayManager; Overlay hud = overlay.GetOverlay("hud") as Overlay; //add timer to the hud overlay hud.Add(timer); }
public void Shoot() { if (!shooting) { Bomb bomb = new Bomb(Mirror, position); shooting = true; GameWorld.Add(bomb); } }
public override void Update(GameTime gameTime) { base.Update(gameTime); if (box.Parent == null || descritption.Parent == null) { box.Parent = this; descritption.Parent = this; GameWorld.Add(box); GameWorld.Add(descritption); } box.Visible = highLighted; descritption.Visible = highLighted; }
public virtual void Add(GameObject obj) { GameWorld.Add(obj); obj.Parent = this; for (int i = 0; i < children.Count; i++) { if (GameWorld.GetObject(children[i]).Layer > obj.Layer) { children.Insert(i, obj.Id); return; } } children.Add(obj.Id); }
public override void Add(GameObject obj, int x, int y) { GameWorld.Add(obj); grid[x, y] = obj.Id; obj.Parent = this; obj.Position = AnchorPosition(x, y); EditorEntity player = obj as EditorEntity; if (player != null) { if (player.EntityType == EntityType.Player) { SwitchSpawnLocation(x, y); } } }
public override void HandleInput(InputHelper inputHelper) { float walkingSpeed = 400; if (walkingOnIce) { walkingSpeed *= 1.5f; } if (!isAlive) { return; } if (inputHelper.IsKeyDown(Keys.Left)) { velocity.X = -walkingSpeed; } else if (inputHelper.IsKeyDown(Keys.Right)) { velocity.X = walkingSpeed; } else if (!walkingOnIce && isOnTheGround) { velocity.X = 0.0f; } if (velocity.X != 0.0f) { Mirror = velocity.X < 0; } if ((inputHelper.KeyPressed(Keys.Space) || inputHelper.KeyPressed(Keys.Up))) { if (isOnTheGround) { Jump(); } } if (inputHelper.IsKeyDown(Keys.Space) || inputHelper.IsKeyDown(Keys.Up)) { holdingUp = true; } else { holdingUp = false; } if (inputHelper.IsKeyDown(Keys.Down)) { movingThroughPlatform = true; } else { movingThroughPlatform = false; } if (inputHelper.KeyPressed(Keys.M)) { if (GameWorld.Find("bomb") != null) { Bomb bomb = GameWorld.Find("bomb") as Bomb; if (!bomb.remove) { bomb.explode(); } bomb.Reset(GlobalPosition - new Vector2(0, Height / 4 * 3), Mirror); } else { Bomb bomb = new Bomb(); GameWorld.Add(bomb); bomb.Reset(GlobalPosition - new Vector2(0, Height / 4 * 3), Mirror); } } }