Advertisement
lavalevel

DonkeyDungeon MonsterLogic

Feb 9th, 2012
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.38 KB | None | 0 0
  1.     for M=1, #currentMap.monsterList do
  2.  
  3.         print ("Monster PSYCH:" .. currentMap.monsterList[M].npcPsych)
  4.         y = ( math.floor(currentMap.monsterList[M].npcXY / currentMapWidth ))
  5.         x = ( currentMap.monsterList[M].npcXY ) - (y * currentMapWidth)
  6.         y = y - 1
  7.        
  8.         MonsterXY = currentMap.monsterList[M].npcXY
  9.         -- is monster Next to player?  And is player facing monster
  10.         print (MonsterXY)
  11.         if playerData.playerInfo.playerXY == (MonsterXY+1) then
  12.             determineDirection = { "left", "back", "right", "front"}
  13.             NextTo= true;currentMap.monsterList[M].npcAction = "attack"
  14.             currentMap.monsterList[M].npcLocation = determineDirection[playerData.playerInfo.playerFacing]
  15.  
  16.         elseif playerData.playerInfo.playerXY == (MonsterXY-1)   then
  17.             determineDirection = { "right", "front", "left", "back"}
  18.             NextTo= true;currentMap.monsterList[M].npcAction = "attack"
  19.             currentMap.monsterList[M].npcLocation = determineDirection[playerData.playerInfo.playerFacing]
  20.  
  21.         elseif playerData.playerInfo.playerXY == (MonsterXY+currentMapWidth)  then
  22.             determineDirection = { "front", "left", "back", "right"}
  23.             NextTo= true;currentMap.monsterList[M].npcAction = "attack"
  24.             currentMap.monsterList[M].npcLocation = determineDirection[playerData.playerInfo.playerFacing]
  25.  
  26.         elseif playerData.playerInfo.playerXY == (MonsterXY-currentMapWidth)  then
  27.             determineDirection = { "back", "right", "front", "left"}
  28.             NextTo= true;currentMap.monsterList[M].npcAction = "attack"
  29.             currentMap.monsterList[M].npcLocation = determineDirection[playerData.playerInfo.playerFacing]
  30.         else
  31.             if currentMap.monsterList[M].npcPsych == "seek" then
  32.                 currentMap.monsterList[M].npcAction = "find"
  33.             end
  34.         end
  35.  
  36.        
  37.         print ("Monster " .. M .. " is " .. currentMap.monsterList[M].npcLocation )
  38.         print ("Monster Will:" .. currentMap.monsterList[M].npcAction)
  39.         if currentMap.monsterList[M].npcPsych == "seek" then
  40.        
  41.             print  ("THIS IS MY THAT FUNCTION FOR MONSTER:" .. y)
  42.  
  43.         end
  44.  
  45.         -- monsterMove()-- This is where I process the data set up above. perhaps I could move this out.
  46.         if currentMap.monsterList[1].npcAction == "attack" then
  47.             print ("Attack Rolled...")
  48.             print ("Npc in front of is:" .. M .. "and" .. "npcInFrontOf is :" )
  49.             -- MonsterAttack()
  50.             media.playEventSound ( "snd/sound_coolSplosion.caf" )
  51.             if currentMap.monsterList[M].npcLocation == "front" then
  52.                 animateMonster()
  53.             end
  54.         end
  55.  
  56.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement