Dark Age Games
Home Dark Age EX Dark Age 2 Message Board Fan Art FAQ Kelzar Mage DALpedia MS Forum
Board Index Dark Age General Bug Report Website Off Topic Register User Edit User User List Search

In reply to: Real Time Battle System... -- William 09:34:56 09-19-2004

Well...
Posted by: Xorlak
15:07:07 09-19-2004

The main loop is probably going to look something like this:

#while(battleover!=0)
{
#get(a$)
#playerturn
#enemyturn
}


When you move your player and enemies, you'll have to update location varaibles for each and check weather those variable conflict with the variables of other players/enemies:

* Enemy movement
* This is simplifed for just one player and enemy
* itemposX!, itemposY!, and playerposX, playerposY! are the x,y
* locations of the enemy and player respectively

#method enemyturn()
{
  #random(4, direction!)
  #if(direction!=1) * North
  {
    #if(itemposX!=playerposX!)
    {
      #checkY!=itemposY!-1
      #if(checkY!~=playerposY!) *make sure it's clear one space above the enemy.  If not, don't move the enemy
      {
        #pushitem(0,"N")
        #itemposY!=itemposY!-1
      }
    }
    #if(itemposX!~=playerposX!)
    {
      #pushitem(0,"N")
      #itemposY!=itemposY!-1    
    }
  }

  #if(direction!=2)
  {
    * do the same, except check to the left...
  }
  
  *etc, for all 4 directions
}


That's the basic idea.  #playerturn will be similar, except you'll obvioulsy be reading the #get(a$) instead of doing a random direction.  To check if the player/enemy is attackable, you add another #if for the case where the x,y positions of the object and place you're checking are the same.

----------
-Xorlak
Edit Post