Skip to content

Commit

Permalink
Merge pull request #191 from calfjohn/master
Browse files Browse the repository at this point in the history
4 commits
  • Loading branch information
fusijie committed Nov 2, 2014
2 parents 0e444b0 + 56d278d commit 440638c
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 253 deletions.
9 changes: 0 additions & 9 deletions src/AttackCommand.lua
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,6 @@ function MageIceSpikes.create(pos, facing, attackInfo, owner)
x:runAction(cc.EaseBackOut:create(cc.MoveBy:create(0.3,cc.V3(0,0,200))))
x:runAction(cc.EaseBounceOut:create(cc.ScaleTo:create(0.4, 1)))

-- local puff = cc.BillboardParticleSystem:create("FX/puffRing2.plist")
-- --local puff = cc.ParticleSystemQuad:create("FX/puffRing.plist")
-- local puffFrame = cc.SpriteFrameCache:getInstance():getSpriteFrame("puff.png")
-- puff:setTextureWithRect(puffFrame:getTexture(), puffFrame:getRect())
-- puff:setCamera(camera)
-- puff:setScale(3)
-- ret:addChild(puff)
-- puff:setGlobalZOrder(-ret:getPositionY()*2+FXZorder)

local magic = cc.BillboardParticleSystem:create(ParticleManager:getInstance():getPlistData("magic"))
local magicf = cc.SpriteFrameCache:getInstance():getSpriteFrame("particle.png")
magic:setTextureWithRect(magicf:getTexture(), magicf:getRect())
Expand Down
3 changes: 0 additions & 3 deletions src/BattleFieldUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ function BattlefieldUI:touchButtonInit()
self._coinAmount:setScaleX(0.8)
self._coinAmount:setScaleY(0.7)
self:addChild(self._coinAmount,2)
-- MessageDispatchCenter:registerMessage(MessageDispatchCenter.MessageType.SPECIAL_KNIGHT, particleRelease)
-- MessageDispatchCenter:registerMessage(MessageDispatchCenter.MessageType.SPECIAL_ARCHER, particleRelease)
-- MessageDispatchCenter:registerMessage(MessageDispatchCenter.MessageType.SPECIAL_MAGE, particleRelease)
end

local scheduleID = nil
Expand Down
27 changes: 6 additions & 21 deletions src/BattleScene.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,16 @@ local function moveCamera(dt)
local cameraPosition = getPosTable(camera)
local focusPoint = getFocusPointOfHeros()
if specialCamera.valid == true then
--local position = cc.pRotateByAngle(cameraPosition, cc.p(specialCamera.position.x, -size.height/2), -360/60/2*dt)
local position = cc.pLerp(cameraPosition, cc.p(specialCamera.position.x, (cameraOffset.y + focusPoint.y-size.height*3/4)*0.5), 5*dt)

camera:setPosition(position)
camera:lookAt(cc.V3(position.x, specialCamera.position.y, 50.0), cc.V3(0.0, 1.0, 0.0))
elseif List.getSize(HeroManager) > 0 then
--local position = cc.V3(focusPoint.x, focusPoint.y, size.height/2-100)
local temp = cc.pLerp(cameraPosition, cc.p(focusPoint.x+cameraOffset.x, cameraOffset.y + focusPoint.y-size.height*3/4), 2*dt)
local position = cc.V3(temp.x, temp.y, size.height/2-100)
camera:setPosition3D(position)
camera:lookAt(cc.V3(position.x, focusPoint.y, 50.0), cc.V3(0.0, 0.0, 1.0))
--cclog("\ncalf %f %f %f \ncalf %f %f 50.000000", position.x, position.y, position.z, focusPoint.x, focusPoint.y)
-- end
camera:setPosition3D(position)
camera:lookAt(cc.V3(position.x, focusPoint.y, 50.0), cc.V3(0.0, 0.0, 1.0))
--cclog("\ncalf %f %f %f \ncalf %f %f 50.000000", position.x, position.y, position.z, focusPoint.x, focusPoint.y)
end
end

Expand All @@ -51,7 +48,6 @@ local function createBackground()

currentLayer:addChild(spriteBg)
spriteBg:setScale(2.65)
--spriteBg:setGlobalZOrder(-9)
spriteBg:setPosition3D(cc.V3(-2300,-1000,0))
spriteBg:setRotation3D(cc.V3(90,0,0))

Expand All @@ -65,15 +61,9 @@ end

local function setCamera()
camera = cc.Camera:createPerspective(60.0, size.width/size.height, 10.0, 4000.0)
-- local focusPoint = getFocusPointOfHeros()
-- local position = cc.V3(focusPoint.x, focusPoint.y-size.height, size.height/2-100)
-- camera:setPosition3D(position)
-- camera:lookAt(cc.V3(focusPoint.x, focusPoint.y, 0.0), cc.V3(0.0, 0.0, 1.0))
camera:setGlobalZOrder(10)
currentLayer:addChild(camera)

-- cameraOffset = cc.V3(0, 0, 0)

for val = HeroManager.first, HeroManager.last do
local sprite = HeroManager[val]
if sprite._puff then
Expand All @@ -85,10 +75,10 @@ local function setCamera()
end

local function gameController(dt)
gameMaster:update(dt)
collisionDetect(dt)
solveAttacks(dt)
moveCamera(dt)
gameMaster:update(dt)
end

local function initUILayer()
Expand Down Expand Up @@ -132,20 +122,15 @@ end

function BattleScene:enableTouch()
local function onTouchBegin(touch,event)
self._prePosition = touch:getLocation()
--cclog("onTouchBegin: %0.2f, %0.2f", self._prePosition.x, self._prePosition.y)
--cclog("onTouchBegin: %0.2f, %0.2f", touch:getLocation())
return true
end

local function onTouchMoved(touch,event)
local location = touch:getLocation()

if self:UIcontainsPoint(location) == nil then
if self:UIcontainsPoint(touch:getLocation()) == nil then
local delta = touch:getDelta()
cameraOffset = cc.pGetClampPoint(cc.pSub(cameraOffset, delta),cameraOffsetMin,cameraOffsetMax)
end

self._prePosition = location
end

local function onTouchEnded(touch,event)
Expand Down
8 changes: 0 additions & 8 deletions src/GlobalVariables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,8 @@ AUDIO_ID =
}
EnumRaceType =
{
"DEBUG",
"BASE",
"HERO", --only this
"WARRIOR",
"KNIGHT",
"ARCHER",
"MAGE",
"MONSTER", --and this
"BOSS",
"DRAGON",
}
EnumRaceType = CreateEnumTable(EnumRaceType)

Expand Down
131 changes: 0 additions & 131 deletions src/MonsterActors.lua

This file was deleted.

27 changes: 1 addition & 26 deletions src/actors/Actor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ function Actor:hurt(collider, dirKnockMode)

--three param judge if crit
local blood = self._hpCounter:showBloodLossNum(damage,self,critical)
if self._name == "Rat" then
blood:setPositionZ(G.winSize.height*0.25)
end
self:addEffect(blood)
return damage
end
Expand Down Expand Up @@ -443,29 +440,7 @@ function Actor:movementUpdate(dt)
--left
self._curFacing = self._curFacing + turnby
end
-- if self._name == "Knight" then
-- --print(RADIANS_TO_DEGREES(angleDt), "angleDt", RADIANS_TO_DEGREES(turnby))
-- end

-- self._curFacing = self._curFacing + turnby
-- if self._name == "Knight" then
-- print(RADIANS_TO_DEGREES(angleDt), "angleDt")end
-- if turnby > (math.pi*2) then
-- turnby = turnby - (math.pi*2)
-- end
-- if self._curFacing > self._targetFacing then
---- if turnby > angleDt then
---- self._curFacing = self._targetFacing
---- else
-- self._curFacing = self._curFacing - turnby
-- --end
-- elseif self._curFacing < self._targetFacing then
---- if turnby < angleDt then
---- self._curFacing = self._targetFacing
---- else
-- self._curFacing = self._curFacing + turnby
-- --end
-- end

self:setRotation(-RADIANS_TO_DEGREES(self._curFacing))
end
--position update
Expand Down
2 changes: 0 additions & 2 deletions src/actors/Dragon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,11 @@ end
function Dragon:normalAttack()
self:normalAttackSoundEffects()
DragonAttack.create(getPosTable(self), self._curFacing, self._normalAttack)
-- BossNormal.create(getPosTable(self), self._curFacing, self._normalAttack)
end

function Dragon:init3D()
self:initShadow()
self._sprite3d = cc.EffectSprite3D:create(file)
-- self._sprite3d:setTexture("model/dragon/xiaohuolong_body.jpg")
self._sprite3d:setScale(10)
self._sprite3d:addEffect(cc.V3(0,0,0),CelLine, -1)
self:addChild(self._sprite3d)
Expand Down
28 changes: 1 addition & 27 deletions src/actors/Knight.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,8 @@ function Knight:ctor()
end

function Knight.create()
local ret = Knight.new()
--ret:setRaceType(EnumRaceType.WARRIOR)


--=====Testing block
ret:idleMode()
function test()
-- ret:walkMode()
-- ret._targetFacing = DEGREES_TO_RADIANS(120)
ret._AIEnabled = true
end
function test2()
ret:idleMode()
ret._targetFacing = 0
end
function test3()
ret:attackMode()
end
function test4()
ret:knockMode({x=-1000,y=00}, 150)
end

--delayExecute(ret,test,0.5)
local ret = Knight.new()

-- delayExecute(ret,test2,2.5)
-- delayExecute(ret,test,3.5)
-- delayExecute(ret,test3,4.5)
--=====testing block
ret._AIEnabled = true
--this update function do not do AI
function update(dt)
Expand Down
Loading

0 comments on commit 440638c

Please sign in to comment.