Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function whateverTheLoopDoes(M)
- print ("Monster PSYCH:" .. currentMap.monsterList[M].npcPsych)
- y = ( math.floor(currentMap.monsterList[M].npcXY / currentMapWidth ))
- x = ( currentMap.monsterList[M].npcXY ) - (y * currentMapWidth)
- y = y - 1
- MonsterXY = currentMap.monsterList[M].npcXY
- -- is monster Next to player? And is player facing monster
- print (MonsterXY)
- if playerData.playerInfo.playerXY == (MonsterXY+1) then
- determineDirection = { "left", "back", "right", "front"}
- NextTo= true;currentMap.monsterList[M].npcAction = "attack"
- currentMap.monsterList[M].npcLocation = determineDirection[playerData.playerInfo.playerFacing]
- elseif playerData.playerInfo.playerXY == (MonsterXY-1) then
- determineDirection = { "right", "front", "left", "back"}
- NextTo= true;currentMap.monsterList[M].npcAction = "attack"
- currentMap.monsterList[M].npcLocation = determineDirection[playerData.playerInfo.playerFacing]
- elseif playerData.playerInfo.playerXY == (MonsterXY+currentMapWidth) then
- determineDirection = { "front", "left", "back", "right"}
- NextTo= true;currentMap.monsterList[M].npcAction = "attack"
- currentMap.monsterList[M].npcLocation = determineDirection[playerData.playerInfo.playerFacing]
- elseif playerData.playerInfo.playerXY == (MonsterXY-currentMapWidth) then
- determineDirection = { "back", "right", "front", "left"}
- NextTo= true;currentMap.monsterList[M].npcAction = "attack"
- currentMap.monsterList[M].npcLocation = determineDirection[playerData.playerInfo.playerFacing]
- else
- if currentMap.monsterList[M].npcPsych == "seek" then
- currentMap.monsterList[M].npcAction = "find"
- end
- end
- print ("Monster " .. M .. " is " .. currentMap.monsterList[M].npcLocation )
- print ("Monster Will:" .. currentMap.monsterList[M].npcAction)
- if currentMap.monsterList[M].npcPsych == "seek" then
- print ("THIS IS MY THAT FUNCTION FOR MONSTER:" .. y)
- end
- -- monsterMove()-- This is where I process the data set up above. perhaps I could move this out.
- if currentMap.monsterList[1].npcAction == "attack" then
- print ("Attack Rolled...")
- print ("Npc in front of is:" .. M .. "and" .. "npcInFrontOf is :" )
- -- MonsterAttack()
- media.playEventSound ( "snd/sound_coolSplosion.caf" )
- if currentMap.monsterList[M].npcLocation == "front" then
- animateMonster()
- end
- end
- end
- for M=1, #currentMap.monsterList do
- local function wtgdClosure()
- return whateverTheLoopDoes(M)
- end
- timer.performWithDelay(2000*M,wtgdClosure,1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement