Permalink
Browse files

got Mr. Freeman in there, and learned a horrible lesson on function s…

…cope
  • Loading branch information...
1 parent 05240fc commit 13864627511fda859d8cade19b3b598646ad1f55 JesterXL committed Sep 23, 2011
View
BIN code/crate.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
49 code/main.lua
@@ -1,4 +1,5 @@
require "players.PlayerJXL"
+require "players.PlayerFreeman"
require("physics")
physics.setDrawMode( "normal" )
physics.start()
@@ -8,12 +9,28 @@ display.setStatusBar( display.HiddenStatusBar )
local stage = display.getCurrentStage()
+local background = display.newRect(0, 0, stage.width, stage.height)
+background:setFillColor(255, 255, 255)
+
+local level = display.newGroup()
+
player = PlayerJXL:new()
player.x = 100
-player.y = 100
+player.y = 300
+
+freeman = PlayerFreeman:new()
+freeman.x = 164
+freeman.y = 300
+
+local t = {}
+function t:timer(event)
+ freeman:shoot()
+ --freeman:jump()
+end
+timer.performWithDelay(500, t, 999)
-local level = display.newGroup()
level:insert(player)
+level:insert(freeman)
local function onTouch(event)
local target = event.target
@@ -68,7 +85,10 @@ function getFloor(name, x, y, width, height)
floor.name = name
floor:setReferencePoint(display.TopLeftReferencePoint)
floor:setFillColor(0, 255, 0, 100)
- assert(physics.addBody(floor, "static", {friction=1}), "Floor failed to add to physics.")
+ assert(physics.addBody(floor, "static",
+ {friction=.3, bounce=0,
+ filter = { categoryBits = 1, maskBits = 6 }}),
+ "Floor failed to add to physics.")
floor.x = x
floor.y = y
level:insert(floor)
@@ -77,15 +97,20 @@ end
local levelWidth = stage.width * 3
- j = display.newImage("crate.png");
- j.x = 60 + math.random( 160 )
- j.y = -100
-
-
-local crate = display.newImage("crate.png")
-crate.x = stage.width + 20
-level:insert(crate)
-physics.addBody(crate, { density=3, friction=0.3, bounce=0.2} )
+local function getCrate(x, y)
+ local crate = display.newImage("crate.png")
+ crate.name = "crate"
+ crate.x = x
+ crate.y = y
+ level:insert(crate)
+ physics.addBody(crate, { density=20, friction=0.3,
+ filter = { categoryBits = 2, maskBits = 7 }} )
+ return crate
+end
+
+local crate1 = getCrate(stage.width - 20, 300)
+local crate2 = getCrate(crate1.x + crate1.width, 300)
+
local bottomFloor = getFloor("floor", 0, stage.height - 50, levelWidth, 50)
local leftWall = getFloor("leftWall", -25, 0, 50, stage.height - 50)
View
BIN code/player_freeman_jump_sheet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN code/player_freeman_run_sheet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN code/player_jxl_jump_right_sheet.png → code/player_freeman_shoot_sheet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN code/player_freeman_stand_sheet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN code/player_jxl_jump_left_sheet.png
Deleted file not rendered
View
BIN code/player_jxl_jump_sheet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN code/player_jxl_run_left_sheet.png
Deleted file not rendered
View
BIN code/player_jxl_run_right_sheet.png
Deleted file not rendered
View
BIN code/player_jxl_run_sheet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN code/player_jxl_stand_sheet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN code/player_jxl_strike_sheet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
280 code/players/PlayerFreeman.lua
@@ -0,0 +1,280 @@
+require "sprite"
+PlayerFreeman = {}
+
+function PlayerFreeman:new()
+
+ if PlayerFreeman.moveSheet == nil then
+ local moveRightSheet = sprite.newSpriteSheet("player_freeman_run_sheet.png", 64, 64)
+ local moveRightSet = sprite.newSpriteSet(moveRightSheet, 1, 7)
+ sprite.add(moveRightSet, "freemanMoveRight", 1, 7, 500, 0)
+ PlayerFreeman.moveRightSheet = moveRightSheet
+ PlayerFreeman.moveRightSet = moveRightSet
+
+ local jumpRightSheet = sprite.newSpriteSheet("player_freeman_jump_sheet.png", 64, 64)
+ local jumpRightSet = sprite.newSpriteSet(jumpRightSheet, 1, 6)
+ sprite.add(jumpRightSet, "freemanJumpRight", 1, 6, 500, 1)
+ PlayerFreeman.jumpRightSheet = jumpRightSheet
+ PlayerFreeman.jumpRightSet = jumpRightSet
+
+ local standSheet = sprite.newSpriteSheet("player_freeman_stand_sheet.png", 64, 64)
+ local standSet = sprite.newSpriteSet(standSheet, 1, 6)
+ sprite.add(standSet, "freemanStand", 1, 6, 1100, 0)
+ PlayerFreeman.standSheet = standSheet
+ PlayerFreeman.standSet = standSet
+
+ local strikeSheet = sprite.newSpriteSheet("player_freeman_shoot_sheet.png", 64, 64)
+ local strikeSet = sprite.newSpriteSet(strikeSheet, 1, 5)
+ sprite.add(strikeSet, "freemanShoot", 1, 5, 500, 1)
+ PlayerFreeman.strikeSheet = strikeSheet
+ PlayerFreeman.strikeSet = strikeSet
+ end
+
+ local player = display.newGroup()
+ player.name = "PlayerFreeman"
+ player.sprite = nil
+ player.direction = "right"
+ player.spriteHolder = display.newGroup()
+ player:insert(player.spriteHolder)
+ player.moving = false
+ player.jumping = false
+ player.shooting = false
+ player.shootingTimer = nil
+ player.moveForce = 10
+ player.speed = 3
+ player.jumpForce = 50
+ player.jumpForwardForce = 30
+
+ function player:showSprite(name)
+ local spriteAnime
+ if name == "move" then
+ spriteAnime = sprite.newSprite(PlayerFreeman.moveRightSet)
+ spriteAnime:prepare("freemanMoveRight")
+ elseif name == "jump" then
+ spriteAnime = sprite.newSprite(PlayerFreeman.jumpRightSet)
+ spriteAnime:prepare("freemanJumpRight")
+ spriteAnime:addEventListener("sprite", player.onJumpCompleted)
+ elseif name == "stand" then
+ spriteAnime = sprite.newSprite(PlayerFreeman.standSet)
+ spriteAnime:prepare("freemanStand")
+ elseif name == "shoot" then
+ spriteAnime = sprite.newSprite(PlayerFreeman.strikeSet)
+ spriteAnime:prepare("freemanShoot")
+ end
+ spriteAnime:setReferencePoint(display.TopLeftReferencePoint)
+ spriteAnime:play()
+ if player.sprite ~= nil then
+ player.sprite:removeSelf()
+ end
+ player.sprite = spriteAnime
+ player.spriteHolder:insert(spriteAnime)
+ spriteAnime.x = 0
+ spriteAnime.y = 0
+ end
+
+ function player:setDirection(dir)
+ self.direction = dir
+ local spriteHolder = player.spriteHolder
+ if dir == "right" then
+ spriteHolder.xScale = 1
+ spriteHolder.x = 0
+ else
+ spriteHolder.xScale = -1
+ spriteHolder.x = spriteHolder.width
+ end
+ end
+
+ function player:moveRight()
+ if self.shooting == false and self.jumping == false then
+ self:setDirection("right")
+ self:showSprite("move")
+ self:startMoving()
+ return true
+ end
+ end
+
+ function player:moveLeft()
+ if self.shooting == false and self.jumping == false then
+ self:setDirection("left")
+ self:showSprite("move")
+ self:startMoving()
+ return true
+ end
+ end
+
+ function player:stand()
+ if self.shooting == false and self.jumping == false then
+ self:stopMoving()
+ self:showSprite("stand")
+ end
+ end
+
+ function player:shoot()
+ if self.shooting == true or self.jumping == true then
+ return
+ end
+
+ self.shooting = true
+ self:showSprite("shoot")
+ if self.shootingTimer ~= nil then
+ timer.cancel(self.shootingTimer)
+ end
+ self.shootingTimer = timer.performWithDelay(500, onShootComplete)
+ end
+
+
+ function onShootComplete(event)
+ local self = player
+ self:showSprite("stand")
+ timer.cancel(self.shootingTimer)
+ self.shootingTimer = nil
+ self.shooting = false
+ end
+
+ function player:startMoving()
+ if self.moving == false and self.jumping == false then
+ self.moving = true
+ Runtime:addEventListener("enterFrame", self)
+ end
+ end
+
+ function player:stopMoving()
+ self.moving = false
+ Runtime:removeEventListener("enterFrame", self)
+ local force
+ if self.direction == "right" then
+ force = self.speed
+ else
+ force = -self.speed
+ end
+ self:applyLinearImpulse(force / 3, 0, 40, 32)
+ end
+
+ function player:enterFrame()
+ -- using physics
+ --[[
+ local force
+ if self.direction == "right" then
+ force = self.moveForce
+ elseif self.direction == "left" then
+ force = -self.moveForce
+ else
+ force = 0
+ end
+ self:applyForce(force, 0, 40, 32)
+ ]]--
+
+ -- using good ole' x en whuy
+ local speed = self.speed
+ local targetX
+ local targetY = self.y
+ if self.direction == "right" then
+ targetX = self.x + speed
+ elseif self.direction == "left" then
+ targetX = self.x - speed
+ else
+ targetX = 0
+ end
+
+
+ local deltaX = self.x - targetX
+ local deltaY = self.y - targetY
+ local dist = math.sqrt((deltaX * deltaX) + (deltaY * deltaY))
+ local moveX = speed * (deltaX / dist)
+ local moveY = speed * (deltaY / dist)
+
+ if (math.abs(moveX) > dist or math.abs(moveY) > dist) then
+ self.x = targetX
+ self.y = targetY
+ else
+ self.x = self.x - moveX
+ self.y = self.y - moveY
+ end
+ end
+
+ function player:jump()
+ print("freeman jump")
+ local score = 0
+ local min = 3
+ if self.shooting == false then score = score + 1 end
+ if self.moving == false then score = score + 1 end
+ if self.jumping == false then score = score + 1 end
+
+ if score >= min then
+ print("\tmade it")
+ self.jumping = true
+ self:showSprite("jump")
+ self:addEventListener("collision", player.onJumpCollision)
+ self:applyLinearImpulse(0, self.jumpForce, 40, 32)
+ end
+ end
+
+ function player:jumpForward()
+ if self.shooting == false and self.moving == false and self.jumping == false then
+ self.jumping = true
+ self:showSprite("jump")
+
+
+
+ local xForce
+ if self.direction == "right" then
+ xForce = self.jumpForwardForce
+ else
+ xForce = -self.jumpForwardForce
+ end
+ --[[
+ self:applyLinearImpulse(xForce, self.jumpForce, 40, 32)
+ ]]--
+ --print("--------------")
+ --self.jumpStartTime = system.getTimer()
+ --Runtime:addEventListener("enterFrame", onJumpForward)
+ self:addEventListener("collision", player.onJumpCollision)
+ local multiplier = 60
+ self:applyForce(xForce* multiplier, self.jumpForce * multiplier, 40, 32)
+ end
+ end
+
+ function player.onJumpCompleted(event)
+ print("onJumpCompleted, phase: ", event.phase, ", frame: ", event.target.currentFrame)
+ if event.phase == "end" then
+ if event.target.currentFrame ~= 6 then
+ print("What the hell")
+ end
+ local self = player
+ event.target:removeEventListener("sprite", player.onJumpCompleted)
+ self:showSprite("stand")
+ self.jumping = false
+ --[[else
+ if event.target.currentFrame >= 4 then
+ event.target:pause()
+ end
+ end]]--
+ end
+ end
+
+ function player.onJumpCollision(event)
+ print("onJumpCollision, phase: ", event.phase)
+ local self = player
+ local anime = self.sprite
+ if event.phase == "began" and anime.currentFrame <= 4 then
+ anime.currentFrame = 5
+ anime:play()
+ self:removeEventListener("collision", player.onJumpCollision)
+ end
+ end
+
+
+ player:showSprite("stand")
+
+ -- 22, 4, 20, 48
+ local playerShape = {22,4, 42,4, 42,52, 22,52}
+ assert(physics.addBody( player, "dynamic",
+ { density=0.8, friction=0.8, bounce=0.1, isBullet=true, shape=playerShape,
+ filter = { categoryBits = 4, maskBits = 3 }} ),
+ "player failed to add to physics.")
+
+ player.isFixedRotation = true
+
+ return player
+end
+
+return PlayerFreeman
View
150 code/players/PlayerJXL.lua
@@ -4,66 +4,45 @@ PlayerJXL = {}
function PlayerJXL:new()
if PlayerJXL.moveSheet == nil then
- local moveRightSheet = sprite.newSpriteSheet("player_jxl_run_right_sheet.png", 64, 64)
+ local moveRightSheet = sprite.newSpriteSheet("player_jxl_run_sheet.png", 64, 64)
local moveRightSet = sprite.newSpriteSet(moveRightSheet, 1, 8)
sprite.add(moveRightSet, "jxlMoveRight", 1, 8, 500, 0)
PlayerJXL.moveRightSheet = moveRightSheet
PlayerJXL.moveRightSet = moveRightSet
- local jumpRightSheet = sprite.newSpriteSheet("player_jxl_jump_right_sheet.png", 80, 64)
+ local jumpRightSheet = sprite.newSpriteSheet("player_jxl_jump_sheet.png", 64, 64)
local jumpRightSet = sprite.newSpriteSet(jumpRightSheet, 1, 6)
sprite.add(jumpRightSet, "jxlJumpRight", 1, 6, 500, 1)
PlayerJXL.jumpRightSheet = jumpRightSheet
PlayerJXL.jumpRightSet = jumpRightSet
local standSheet = sprite.newSpriteSheet("player_jxl_stand_sheet.png", 64, 64)
- local standSet = sprite.newSpriteSet(standSheet, 1, 4)
- sprite.add(standSet, "jxlStand", 1, 4, 1000, 0)
+ local standSet = sprite.newSpriteSet(standSheet, 1, 6)
+ sprite.add(standSet, "jxlStand", 1, 6, 1000, 0)
PlayerJXL.standSheet = standSheet
PlayerJXL.standSet = standSet
- local strikeSheet = sprite.newSpriteSheet("player_jxl_strike_sheet.png", 80, 64)
+ local strikeSheet = sprite.newSpriteSheet("player_jxl_strike_sheet.png", 64, 64)
local strikeSet = sprite.newSpriteSet(strikeSheet, 1, 6)
- sprite.add(strikeSet, "jxlStrike", 1, 6, 500, 1)
+ sprite.add(strikeSet, "jxlStrike", 1, 6, 300, 1)
PlayerJXL.strikeSheet = strikeSheet
PlayerJXL.strikeSet = strikeSet
end
local player = display.newGroup()
+ player.name = "PlayerJXL"
player.sprite = nil
player.direction = "right"
- player.strikeTime = 500
player.spriteHolder = display.newGroup()
player:insert(player.spriteHolder)
player.moving = false
player.jumping = false
+ player.striking = false
+ player.strikingTimer = nil
player.moveForce = 10
player.speed = 3
player.jumpForce = 50
- player.jumpForwardForce = 52
-
- --[[
- local sizeRect = display.newRect(22, 4, 20, 48)
- sizeRect:setReferencePoint(display.TopLeftReferencePoint)
- sizeRect.strokeWidth = 1
- sizeRect:setFillColor(255, 0, 0, 100)
- sizeRect:setStrokeColor(255, 0, 0)
- PlayerJXL.sizeRect = sizeRect
- player:insert(sizeRect)
- sizeRect.isFixedRotation = true
- ]]--
-
- local strikeRect = display.newRect(0, 0, 32, 10)
- strikeRect:setReferencePoint(display.TopLeftReferencePoint)
- strikeRect.strokeWidth = 1
- strikeRect:setFillColor(255, 0, 0, 100)
- strikeRect:setStrokeColor(255, 0, 0)
- player.spriteHolder:insert(strikeRect)
- strikeRect.isHitTestable = false
- strikeRect.isVisible = false
- strikeRect.x = 40
- strikeRect.y = 32
- player.strikeRect = strikeRect
+ player.jumpForwardForce = 30
function player:showSprite(name)
local spriteAnime
@@ -73,7 +52,7 @@ function PlayerJXL:new()
elseif name == "jump" then
spriteAnime = sprite.newSprite(PlayerJXL.jumpRightSet)
spriteAnime:prepare("jxlJumpRight")
- spriteAnime:addEventListener("sprite", onJumpCompleted)
+ spriteAnime:addEventListener("sprite", player.onJumpCompleted)
elseif name == "stand" then
spriteAnime = sprite.newSprite(PlayerJXL.standSet)
spriteAnime:prepare("jxlStand")
@@ -100,13 +79,13 @@ function PlayerJXL:new()
spriteHolder.x = 0
else
spriteHolder.xScale = -1
- spriteHolder.x = spriteHolder.width - 9
+ spriteHolder.x = spriteHolder.width
end
end
function player:moveRight()
- print("moveRight: ", self.jumping)
- if self:striking() == false and self.jumping == false then
+ --print("moveRight: ", self.jumping)
+ if self.striking == false and self.jumping == false then
self:setDirection("right")
self:showSprite("move")
self:startMoving()
@@ -115,8 +94,8 @@ function PlayerJXL:new()
end
function player:moveLeft()
- print("moveLeft: ", self.jumping)
- if self:striking() == false and self.jumping == false then
+ --print("moveLeft: ", self.jumping)
+ if self.striking == false and self.jumping == false then
self:setDirection("left")
self:showSprite("move")
self:startMoving()
@@ -125,57 +104,32 @@ function PlayerJXL:new()
end
function player:stand()
- if self:striking() == false and self.jumping == false then
+ if self.striking == false and self.jumping == false then
self:stopMoving()
self:showSprite("stand")
end
end
- function player:striking()
- local strikeRect = self.strikeRect
- if strikeRect.tween ~= nil then
- return true
- else
- return false
- end
- end
-
function player:strike()
- if self.jumping == true then
- return
- end
-
- local strikeRect = self.strikeRect
- if strikeRect.tween ~= nil then
+ if self.striking == true or self.jumping == true then
return
end
+ self.striking = true
self:showSprite("strike")
- strikeRect.isHitTestable = true
- strikeRect.isVisible = true
- if strikeRect.tween ~= nil then
- transition.cancel(strikeRect.tween)
+ if self.strikingTimer ~= nil then
+ timer.cancel(self.strikingTimer)
end
-
- strikeRect.x = 0
- local halfStrikeTime = self.strikeTime / 2
- strikeRect.tween = transition.to(strikeRect, {time=halfStrikeTime, x=48, onComplete=onStrikeOutComplete})
+ self.strikingTimer = timer.performWithDelay(500, onStrikeComplete)
end
- function onStrikeOutComplete(strikeRect)
- local self = player
- transition.cancel(strikeRect.tween)
- local halfStrikeTime = self.strikeTime / 2
- strikeRect.tween = transition.to(strikeRect, {time=halfStrikeTime, x=0, onComplete=onStrikeOutAndInComplete})
- end
- function onStrikeOutAndInComplete(strikeRect)
+ function onStrikeComplete(event)
local self = player
self:showSprite("stand")
- transition.cancel(strikeRect.tween)
- strikeRect.tween = nil
- strikeRect.isHitTestable = false
- strikeRect.isVisible = false
+ timer.cancel(self.strikingTimer)
+ self.strikingTimer = nil
+ self.striking = false
end
function player:startMoving()
@@ -242,7 +196,7 @@ function PlayerJXL:new()
function player:jump()
local score = 0
local min = 3
- if self:striking() == false then score = score + 1 end
+ if self.striking == false then score = score + 1 end
if self.moving == false then score = score + 1 end
if self.jumping == false then score = score + 1 end
@@ -255,27 +209,48 @@ function PlayerJXL:new()
end
function player:jumpForward()
- if self:striking() == false and self.moving == false and self.jumping == false then
+ if self.striking == false and self.moving == false and self.jumping == false then
self.jumping = true
self:showSprite("jump")
- self:addEventListener("collision", onJumpCollision)
+
+
+
local xForce
if self.direction == "right" then
xForce = self.jumpForwardForce
else
xForce = -self.jumpForwardForce
end
+ --[[
self:applyLinearImpulse(xForce, self.jumpForce, 40, 32)
+ ]]--
+ --print("--------------")
+ --self.jumpStartTime = system.getTimer()
+ --Runtime:addEventListener("enterFrame", onJumpForward)
+ self:addEventListener("collision", player.onJumpCollision)
+ local multiplier = 60
+ self:applyForce(xForce* multiplier, self.jumpForce * multiplier, 40, 32)
end
end
- function onJumpCompleted(event)
+ function player.onJumpCollision(event)
+ print("onJumpCollision, tar: ", event, ", self: ", self)
+ local self = player
+ local anime = self.sprite
+ if event.phase == "began" and anime.currentFrame <= 4 then
+ anime.currentFrame = 5
+ anime:play()
+ self:removeEventListener("collision", player.onJumpCollision)
+ end
+ end
+
+ function player.onJumpCompleted(event)
if event.phase == "end" then
if event.target.currentFrame ~= 6 then
print("What the hell")
end
local self = player
- event.target:removeEventListener("sprite", onJumpCompleted)
+ event.target:removeEventListener("sprite", player.onJumpCompleted)
self:showSprite("stand")
self.jumping = false
else
@@ -285,25 +260,16 @@ function PlayerJXL:new()
end
end
- function onJumpCollision(event)
- local self = player
- local anime = self.sprite
- if event.phase == "began" and anime.currentFrame == 4 then
- anime.currentFrame = 5
- anime:play()
- self:removeEventListener("collision", onJumpCollision)
- end
- end
-
-
player:showSprite("stand")
- -- 22, 4, 20, 48
local playerShape = {22,4, 42,4, 42,52, 22,52}
- assert(physics.addBody( player, "dynamic", { density=0.8, friction=0.8, bounce=0.1, shape=playerShape} ), "SizeRect failed to add to physics.")
- --assert(physics.addBody( strikeRect, "dynamic", { density=4.0, friction=0.2, bounce=0.1, isSensor=true, isBullet=true} ), "StrikeRect failed to add to physics.")
-
+ assert(physics.addBody( player, "dynamic",
+ { density=0.8, friction=0.8, bounce=0.1, isBullet=true, shape=playerShape,
+ filter = { categoryBits = 4, maskBits = 3 }} ),
+ "SizeRect failed to add to physics.")
+
player.isFixedRotation = true
+
return player
end
View
67 code/zombie_flash.tmproj
@@ -10,25 +10,37 @@
<key>filename</key>
<string>main.lua</string>
<key>lastUsed</key>
- <date>2011-09-22T03:43:44Z</date>
+ <date>2011-09-23T05:44:43Z</date>
<key>selected</key>
<true/>
</dict>
<dict>
<key>filename</key>
- <string>player_jxl_jump_left_sheet.png</string>
+ <string>crate.png</string>
</dict>
<dict>
<key>filename</key>
- <string>player_jxl_jump_right_sheet.png</string>
+ <string>player_freeman_jump_sheet.png</string>
</dict>
<dict>
<key>filename</key>
- <string>player_jxl_run_left_sheet.png</string>
+ <string>player_freeman_run_sheet.png</string>
</dict>
<dict>
<key>filename</key>
- <string>player_jxl_run_right_sheet.png</string>
+ <string>player_freeman_shoot_sheet.png</string>
+ </dict>
+ <dict>
+ <key>filename</key>
+ <string>player_freeman_stand_sheet.png</string>
+ </dict>
+ <dict>
+ <key>filename</key>
+ <string>player_jxl_jump_sheet.png</string>
+ </dict>
+ <dict>
+ <key>filename</key>
+ <string>player_jxl_run_sheet.png</string>
</dict>
<dict>
<key>filename</key>
@@ -56,7 +68,7 @@
<key>filename</key>
<string>config.lua</string>
<key>lastUsed</key>
- <date>2011-09-22T02:03:09Z</date>
+ <date>2011-09-23T02:35:00Z</date>
</dict>
</array>
<key>fileHierarchyDrawerWidth</key>
@@ -82,39 +94,70 @@
<key>caret</key>
<dict>
<key>column</key>
- <integer>20</integer>
+ <integer>36</integer>
<key>line</key>
- <integer>18</integer>
+ <integer>105</integer>
</dict>
<key>firstVisibleColumn</key>
<integer>0</integer>
<key>firstVisibleLine</key>
+ <integer>80</integer>
+ </dict>
+ <key>players/PlayerFreeman.lua</key>
+ <dict>
+ <key>caret</key>
+ <dict>
+ <key>column</key>
+ <integer>2</integer>
+ <key>line</key>
+ <integer>250</integer>
+ </dict>
+ <key>firstVisibleColumn</key>
<integer>0</integer>
+ <key>firstVisibleLine</key>
+ <integer>221</integer>
</dict>
<key>players/PlayerJXL.lua</key>
<dict>
<key>caret</key>
<dict>
<key>column</key>
- <integer>1</integer>
+ <integer>18</integer>
<key>line</key>
- <integer>30</integer>
+ <integer>206</integer>
</dict>
+ <key>columnSelection</key>
+ <false/>
<key>firstVisibleColumn</key>
<integer>0</integer>
<key>firstVisibleLine</key>
- <integer>7</integer>
+ <integer>190</integer>
+ <key>selectFrom</key>
+ <dict>
+ <key>column</key>
+ <integer>8</integer>
+ <key>line</key>
+ <integer>206</integer>
+ </dict>
+ <key>selectTo</key>
+ <dict>
+ <key>column</key>
+ <integer>26</integer>
+ <key>line</key>
+ <integer>206</integer>
+ </dict>
</dict>
</dict>
<key>openDocuments</key>
<array>
<string>main.lua</string>
<string>players/PlayerJXL.lua</string>
+ <string>players/PlayerFreeman.lua</string>
<string>config.lua</string>
</array>
<key>showFileHierarchyDrawer</key>
<true/>
<key>windowFrame</key>
- <string>{{610, 299}, {825, 579}}</string>
+ <string>{{581, 146}, {724, 710}}</string>
</dict>
</plist>
View
24 fireworks-commands/move-right.jsf
@@ -0,0 +1,24 @@
+var doc = fw.getDocumentDOM()
+var distance = prompt("Distance: ", 64)
+distance = parseInt(distance)
+doc.selectAll()
+var len = fw.selection.length
+var startX = distance
+for(var index = 1; index < len; index++)
+{
+ var obj = fw.selection[index]
+ obj.left = obj.left + startX
+ startX += distance
+}
+
+var w = doc.width
+var guidesNum = w / distance
+if(guidesNum > 0)
+{
+ var startX = distance
+ for(var index = 1; index < guidesNum; index++)
+ {
+ fw.getDocumentDOM().addGuide(startX, "vertical");
+ startX += distance
+ }
+}
View
17 fireworks-commands/swap-direction.jsf
@@ -0,0 +1,17 @@
+var doc = fw.getDocumentDOM()
+var distance = prompt("Distance: ", 64)
+distance = parseInt(distance)
+doc.selectAll()
+var len = fw.selection.length
+var posArray = []
+for(var index = 0; index < len; index++)
+{
+ var obj = fw.selection[index]
+ posArray[index] = obj.left
+}
+posArray.reverse()
+for(var index = 0; index < len; index++)
+{
+ var obj = fw.selection[index]
+ obj.left = posArray[index]
+}

0 comments on commit 1386462

Please sign in to comment.