Ejemplo n.º 1
0
    public override void _Input(InputEvent inputEvent)
    {
        int x = 0;
        int y = 0;

        if (inputEvent.IsActionPressed("mv_up"))
        {
            y = -1;
        }
        if (inputEvent.IsActionPressed("mv_down"))
        {
            y = 1;
        }
        if (inputEvent.IsActionPressed("mv_left"))
        {
            x = -1;
        }
        if (inputEvent.IsActionPressed("mv_right"))
        {
            x = 1;
        }
        // only move one axis at a time (no diagonal movement)
        if (x != 0)
        {
            y = 0;
        }

        if (PlayerMoveGrid(MoveGridRelativeBase(x, y)))
        {
            soundManager.Call("PlayAffect", "res://Sounds/mvmt5.wav");
        }
        if (myInputTimer.IsStopped())
        {
            myInputTimer.Start();
        }
    }
Ejemplo n.º 2
0
    public void OpenChest()
    {
        if (sprite.Frame == 1)
        {
            return;
        }
        ZIndex = 101;

        sprite.Frame     = 1;     // open treasure chest
        goldShine.Energy = goldBrightness;

        for (int i = 0; i < 4; i++)
        {
            var coinInstance = (AnimatedSprite)coin.Instance();
            AddChild(coinInstance);
        }
        soundManager.Call("PlayAffect", "res://Sounds/chest3.wav");
    }
 public void _onButtonPressed()
 {
     if (GetNodeOrNull("/root/game/Camera2D") != null)
     {
         GetNodeOrNull("/root/game/Camera2D").Call("add_trauma", 0.25);
     }
     soundManager.Call("PlayAffect", "res://Sounds/Untitled.wav");
     if (rotated)
     {
         theGrid.ShiftColumnDown(number);
         theGrid.SetUpMenuGrid();
     }
     else
     {
         theGrid.ShiftRowRight(number);
         theGrid.SetUpMenuGrid();
     }
 }
Ejemplo n.º 4
0
    public void LaserAttack(int dir)
    {
        soundManager.Call("PlayAffect", "res://Sounds/mvmt3.wav");
        switch (dir)
        {
        case 1:
            ShootLaser(false, 1);
            break;

        case 2:
            ShootLaser(false, -1);
            break;

        case 3:
            ShootLaser(true, 1);
            break;

        case 4:
            ShootLaser(true, -1);
            break;
        }
    }