in reply to Re^7: Module Organization
in thread Module Organization

I'm ahead of my class right now (they're going on lists) but it seems I'm unable to get them to install moose on the computers (something about the way the computer images every time the user logs off and on) so I'm stuck with regular OOP in class, sadly, which seriously hinders my will to use moose... :(

I did install Moose on my home computer, though, so we'll see if I don't get anything out of that...

I've got a problem visually thinking about the whole idea of the game loop, will be looking it up to see if there's anything to more readily help visualize it, as well as how to handle game//dungeon progression in the game.

Some stuff I'm doing:

Get the Game loop up

Get some file handling going for persistent data

Design inventory system as well as attribute system


Here's some example code:
sub role_play_game { print "What is the Name of the character you wish to play as? "; chomp ( $name = <STDIN>); print "What is the gender of your character? m/f: "; chomp ( $gender = <STDIN> ); print "What is the Age of the character? (years): "; chomp ( $age = <STDIN>); print "\n"; $player = new Player ($name, $gender, $age); $player->getValues; $player->start; $player->invent; } package Player; sub new { my $class = shift; my $self = { name => shift, gender => shift, age => shift, level => 1, hp => 10, currhp => 10, }; $inv = { q_itm => "no", money => 0, }; # Print all the values just for clarification. bless ($self, $class); bless ($inv); return $self; } sub getValues { my $self = shift; print "\nName is $self->{name}\n"; print "Gender is $self->{gender}\n"; print "Age is $self->{age}\n"; } sub start { my $self = shift; print "You are Level $self->{level}\n"; print "You have $self->{currhp} of $self->{hp} hit points left!\n" +; } sub invent { #This is where it gets a little... dirty. print "You have $inv->{q_itm} quest items!\n"; print "You have $inv->{money} gold!\n"; } 1;
Also, soon enough I'll have a CPAN Roleplay module up so that others can contribute if they want to help out, haha. Also, that magic +; came in from nowhere >.>