Results 1 to 2 of 2

Thread: Combat system

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    For clarity i'd make another function (still pseudo):

    Code:
    function IsCountered(action, defence): boolean
      result = true
      if action = attack then
        if (defence = magic) or (defence = attack) then
          result = false
      else if action = magic then
        if (defence = magic) or (defence = block) then
          result = false
      else if (action = block) and (defence = attack) then
        result = false
    
    Main app:
    
    player_attack_blocked = IsCountered(player_attack, mob_attack)
    mob_attack_blocked = IsCountered(mob_attack, player_attack)
    if not player_attack_blocked then
      hit mob
    if not mob_attack_blocked then
      hit player
    if player_attack_blocked and mob_attack_blocked then
      draw
    Last edited by User137; 19-12-2011 at 03:32 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •