Skip to content

Instantly share code, notes, and snippets.

@djanatyn
Created July 17, 2011 00:07
Show Gist options
  • Save djanatyn/1086958 to your computer and use it in GitHub Desktop.
Save djanatyn/1086958 to your computer and use it in GitHub Desktop.
roguelike
#!/usr/bin/perl -w
use strict;
use Curses;
my %player = (
'health' => 100,
'x' => 5,
'y' => 5,
);
sub walking {
my $_ = getch;
if (/h/) { $player{x}--; };
if (/j/) { $player{y}++; };
if (/k/) { $player{y}--; };
if (/l/) { $player{x}++; };
}
initscr;
while(1) {
addch($player{y},$player{x},"@");
move($player{y},$player{x});
refresh;
&walking;
clear;
}
endwin;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment