
-----------------------------------
DanShadow
Sat Dec 13, 2003 6:30 pm

[Tutorial] Graphical RPG
-----------------------------------
I have a few motivations for writing this tutorial, the first being that many new programmers first ambitions for starting to learn programming is to create some awesome game to impress everybody, and make themselves look almighty. (Also to control a few peoples lives, heh. :wink: ) The second being I would love to have some bits, so if you like this tutorial, learn something from this tutorial, or are interested while reading this tutorial, please donate bits.  :D 

Step 1
The Planning Process
Normally, Role Playing Games do not end up good, if you dont know what your doing, makes sense right? I suggest setting out an hour or two of quiet time, taking a pen and paper, go into a silent place, and think.  What is good about an RPG? What do people like in an RPG? Why do I like in an RPG? Write these ideas down, because they are all important. Here are a few things you must decide: when will this RPG be taking place? (present, past, future....dark ages, feudal ages, alien homeworld) Then think of what kind of characters you want in the game. (Humans, monsters, demons, aliens, whatdotcolor warriors...) After these are done, you'll want to think about what can be done in this game. (killing monsters, levelling up, increasing stats, getting better weapons/armor, gaining new allies, destroying big bosses, etc.) Then think of a goal for the user to accomplish in the game. 
Everything that has a beginning, has an end...
(ex. You must raise your magic and strength to be all powerful, and once this is accomplished, you may travel through the Woods of Desolation, and travel up to Hells Tower. Only there will  you face off against the ultimate evil...who you must destroy to save everything that is, and will come to be!) Then you may want to think of certain challenges in the way in your quest. (Like a Giant Horrid Ogre, who can only be gotten past, if you feed it the Elixir of Weakness at the stroke of midnight.) From each of these encounters, the player should probably receive some reward, like a new weapon, or a powerful arcane spellbook.  After this,  you will probably want to take out a big piece of grid paper, size it in pixels, draw the four sectors (or quandrants)...then draw up a map. This process makes the game immensley easy. But! do not make it out to be the dimensions of the screen (640*400), make it much larger. Ill explain this later though. Then you will probably want to think or some sort of skill tree, or circle of spells.. its easier if you do this now, believe me.   With all these steps done, your far into your way to making a great, graphical RPG!

Step 2
The Drawing Process
This will only be needed if you are not importing your own images.
Open up something like MSPaint, and draw a grid of squares, 10*10. Each square should be 10 pixels across and above. This will help you quite easily in the item, character, enemy, map design process. Now on this grid, draw whatever you want to see in your game. (ex. the hero) Make an (x,y) co-ordinate, (maybe at the chest) as a starting point. Open up Turing beside this Window (sized down), and start measuring away. Make Draw.Line commands based on lines relative to the x and y co-ordinates.
(Draw.Line(x-50, y-30,x+10,y+30,255)

Step 3
The Programming Process

The Secret to Scrolling
Make scrolling games is pretty much up to a few arrays. Make an array called "object_x" and "object_y". For every object, whether a tree, fence, wall, castle. Make the "object_x,object_y" equal to each of their (x,y) co-ordinates (as explained above). Now for movement, when the user right clicks to move, (if mouse_button=100) then record that as destination_x, and destination_y (and a variable called unit_moving. Make it equal to "yes"). Now do something like:

if unit_moving="yes" then
   if destination_x>unit_x then
     for i:1..length(object_x)
       object_x(i):=object_x(i)-1
     end for
   elsif destination_xunit_y then
     for i:1..length(object_y)
       object_y(i):=object_y(i)-1
     end for
   elsif destination_y