Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
    //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);
    }
Ejemplo n.º 4
0
 public void Shoot()
 {
     if (!shooting)
     {
         Bomb bomb = new Bomb(Mirror, position);
         shooting = true;
         GameWorld.Add(bomb);
     }
 }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
    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);
            }
        }
    }
Ejemplo n.º 8
0
    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);
            }
        }
    }