Monday, February 02, 2009

Game procedures

I'm almost at the stage where I've planned out a lot of stuff and studied a lot of techniques used when making 2d tile games. I really want to get stuck into coding, but I thought it would be a good idea to just map out some of the stuff in my head about how things will work. Below is some pseudo code I've come up with:
check if player clicked
if player single clicks in area do nothing
if player single click in interface then act accordingly (ie change action etc)
if player double-clicks:
 first check what action is current (ie talk, attack, pickup, walk)
 case talk:
  if its not an npc then do nothing
  if its an npc and its next to the player:
  initiate talking
 case attack:
  if its not an npc then do nothing
  if its an npc:
   if the npc is too far away (ie not next to the player) then do nothing
   else if the player has enough turn points:
    attack the npc
 case pickup:
  if its not an item then do nothing
  if it is an item:
   if the item is too far away (ie not next to the player) then do nothing
   else if the player has enough turn points:
    pickup the item
 case walk:
  set the point as the destination
  walk towards that area until points run out

if player finishes turn then update other game logic (ie move npcs etc)

update the graphics
draw the map
draw the objects (player, items, npcs, trees, etc)
draw the interface
Obviously, there is heaps missing, but I wanted to get the most important things sorted out. The new thing I've introduced here is that I've decided to make the game turn based. I want the player to remain relaxed and make informed decisions, rather than have an arcade frantic feel.

No comments:

Post a Comment