Skip to content

Commit

Permalink
add some error checks, small functionality update
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchwadair committed Feb 15, 2020
1 parent d425727 commit 7fd25ba
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
Binary file added build/SFramework_v0.2.1
Binary file not shown.
16 changes: 12 additions & 4 deletions src/SFramework/Scripts/Engines/SpriteRenderer.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--[[ Sidescroller Framework V0.2.0 ]]--
--[[ Sidescroller Framework V0.2.1 ]]--
--[[ Made by Mitchell Adair ]]--

function Behavior:Awake()
Expand Down Expand Up @@ -38,9 +38,9 @@ end
@param sprite the Asset to assign
]]--
function Behavior:SetSprite(sprite)
self.sprite = sprite
self.gameObject.textRenderer:SetFont(sprite)
self.gameObject.textRenderer:SetText(" ")
self.sprite = sprite
end

--[[
Expand All @@ -53,11 +53,15 @@ function Behavior:SetAnimation(animationAsset, numFrames)
if numFrames == nil then
error("missing required argument 'numFrames' in SetAnimation call")
return
else if type(numFrames) ~= "number" then
error("argument 'numFrames' in SetAnimation call should be a number")
return
end
self.currentAnimation = animationAsset
self.gameObject.textRenderer:SetFont(animationAsset)
self.currentAnimation = animationAsset
self.currentAnimFrame = 0
self.numFrames = numFrames
self.animCounter = 0
end

--[[
Expand All @@ -75,6 +79,10 @@ end
@param ticks the number of game ticks for the frame to last
]]--
function Behavior:SetAnimationFrameDuration(ticks)
if type(ticks) ~= "number" then
error("argument 'ticks' in SetAnimationFrameDuration call should be a number")
return
end
self.animSpeed = ticks
end

Expand Down Expand Up @@ -165,5 +173,5 @@ function Behavior:Update()
end
end

--[[ Sidescroller Framework V0.2.0 ]]--
--[[ Sidescroller Framework V0.2.1 ]]--
--[[ Made by Mitchell Adair ]]--
4 changes: 2 additions & 2 deletions src/SFramework/Scripts/SFramework.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--[[ Sidescroller Framework V0.2.0 ]]--
--[[ Sidescroller Framework V0.2.1 ]]--
--[[ Made by Mitchell Adair ]]--

SF = {}
Expand Down Expand Up @@ -28,5 +28,5 @@ function GameObject:CreateSpriteRenderer(sprite)
return renderer
end

--[[ Sidescroller Framework V0.2.0 ]]--
--[[ Sidescroller Framework V0.2.1 ]]--
--[[ Made by Mitchell Adair ]]--
4 changes: 2 additions & 2 deletions src/SFramework/Tables.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--[[ Sidescroller Framework Tables V0.2.0 ]]--
--[[ Sidescroller Framework Tables V0.2.1 ]]--
--[[ Made by Mitchell ]]--



--[[ Sidescroller Framework Tables V0.2.0 ]]--
--[[ Sidescroller Framework Tables V0.2.1 ]]--
--[[ Made by Mitchell ]]--

0 comments on commit 7fd25ba

Please sign in to comment.