R
Ruairidh Mchardy
Hi all,
I'm currently coding a text-based RPG in Ruby which is great fun but I'm
having some difficulty in structuring it.
So far I have a main.rb file containing a class for the basic enemy and
then an extension for the enemy of the lowest level (Grunt). To test I
created an instance of Grunt and assigned it an hp of 100.
I then create a var for the assignment of damages (random number
between 1 and 100) and finally test it all out by hard-coding an example
battle. This also works.
My problem is that I feel my code is not clean at all and that the
structure feels inefficient. As I will be extending the game in the
future I want to make sure that every aspect of it is neat and easy to
maintain.
Attached is my script, does anyone have any suggestions?
Thanks!
Attachments:
http://www.ruby-forum.com/attachment/2882/main.rb
I'm currently coding a text-based RPG in Ruby which is great fun but I'm
having some difficulty in structuring it.
So far I have a main.rb file containing a class for the basic enemy and
then an extension for the enemy of the lowest level (Grunt). To test I
created an instance of Grunt and assigned it an hp of 100.
I then create a var for the assignment of damages (random number
between 1 and 100) and finally test it all out by hard-coding an example
battle. This also works.
My problem is that I feel my code is not clean at all and that the
structure feels inefficient. As I will be extending the game in the
future I want to make sure that every aspect of it is neat and easy to
maintain.
Attached is my script, does anyone have any suggestions?
Thanks!
Attachments:
http://www.ruby-forum.com/attachment/2882/main.rb