Cancer of the colon has spread to become cancer of the indents
>.<
namespace, class,if, ifelse, for, if, if.
I count 7 there.
static void ProcessInput()
{
int previousx=player.X;
int previousy=player.Y;
int dx=0;
int dy=0;
int dother = 0;
// Is the player moving?
if (gamestate >= 0) // changed to operate when key is
{ // released, bug, player can still hold more than one
if (InputManager.IsPressed(Keys.Up))
keypressed_updown = 1;
else if (keypressed_updown == 1)
{ dy -= 1; keypressed_updown = 0; }
if (InputManager.IsPressed(Keys.Down))
keypressed_updown = -1;
else if (keypressed_updown == -1)
{ dy += 1; keypressed_updown = 0; }
if (InputManager.IsPressed(Keys.Left))
keypressed_leftright = -1;
else if (keypressed_leftright == -1)
{ dx -= 1; keypressed_leftright = 0; }
if (InputManager.IsPressed(Keys.Right))
keypressed_leftright = 1;
else if (keypressed_leftright == 1)
{ dx += 1; keypressed_leftright = 0; }
if (InputManager.IsPressed(Keys.Enter))
{
keypressed_leftright = 0;
keypressed_updown = 0;
keypressed_enter = 1;
}
else
{
if (keypressed_enter > 0) { }
keypressed_enter = 0;
dother = 1;
}
if (dy == 0 & dx == 0 & dother == 0)
{
}
else
{
player.X += dx;
player.Y += dy;
goblin h;
for (int i = 0; i < goblins.Length; i++)// player kills goblins
{
h = goblins[i];
if ((h.loc.X == player.X) & (h.loc.Y == player.Y))
{
h.setx(-1);
h.sety(-1);
h.alive = -1;
score++;
}
}
//if ((x == playerx) & (y == playery))
// Keep the player on the screen
if (player.X < 0) player.X = 0;
else if (player.X * 16 > Video.width - 16) player.X = Video.width / 16 - 1;
if (player.Y < 0) player.Y = 0;
else if (player.Y * 16 > Video.height - 16) player.Y = Video.height / 16 - 1;
if (!(previousx - player.X == 0) || !(previousy - player.Y == 0))
gamestate = goblin.update(player.X, player.Y, goblins);
}
}
}
}/*
But anyway, All of the goblins now path towards the player. If the player moves onto the goblin, the goblin is killed.
If the goblin moves onto the player, the player dies.
Of course, the goblins can move diagonally while the player can't, so it's kinda unfair and impossible to win. But it works! god dam that was alot more work than I thought, but it works!