[Solved]Loading Files from Another Folder

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
shatterblast
Party member
Posts: 136
Joined: Tue Dec 11, 2012 9:47 pm
Location: Dallas, Texas, USA

[Solved]Loading Files from Another Folder

Post by shatterblast »

I'm trying to tidy up my code and files, but I'm finding that what I thought worked now doesn't. I'm just trying to load graphics from another folder. The error refers to the first line of code. Thanks for any help.

Code: Select all

local saphir_stance_anim = love.graphics.newImage("saphir_graphics/saphir_stance.png")
local saphir_shell_anim = love.graphics.newImage("saphir_graphics/Saphir_Shell_Burst.png")
local saphir_cannon_anim = love.graphics.newImage("saphir_graphics/Saphir_Capacitor_Cannon.png")
local saphir_rally_anim = love.graphics.newImage("saphir_graphics/Saphir_Rally.png")

--______________________________________________________________________

local back_ground = love.graphics.newImage("background01.png")

--______________________________________________________________________

local spritesheet1 = love.graphics.newImage("sparkle_set01.png")
local spritesheet2 = love.graphics.newImage("sparkle_set02.png")
local spritesheet3 = love.graphics.newImage("sparkle_set03.png")

--______________________________________________________________________
  
local animationState_Effects = "Effect_0"
local state_of_saphir = "Effect_Saphir_1"

function love.load()
  require("anal")
  
  spritesheet1:setFilter("nearest", "nearest")
  animation1 = newAnimation(spritesheet1, 192, 192, 0.1, 110)
  --______________________________________________________________________
  
  spritesheet2:setFilter("nearest", "nearest")
  animation2 = newAnimation(spritesheet2, 200, 200, 0.1, 80)
  --______________________________________________________________________
    
  spritesheet3:setFilter("nearest", "nearest")
  animation3 = newAnimation(spritesheet3, 200, 200, 0.1, 80)
  --______________________________________________________________________  
    
  saphir_stance_anim:setFilter("nearest", "nearest")
  --MAKE SURE THE LAST NUMBER IS THE NUMBER OF FRAMES!!!
  saphir_animate_01 = newAnimation(saphir_stance_anim, 156, 248, 0.1, 8)
  
  --______________________________________________________________________
  
  saphir_shell_anim:setFilter("nearest", "nearest")
  --MAKE SURE THE LAST NUMBER IS THE NUMBER OF FRAMES!!!
  saphir_animate_02 = newAnimation(saphir_shell_anim, 203, 248, 0.1, 21)
  
  --______________________________________________________________________
  --animation numbers are wrong
  saphir_canon_anim:setFilter("nearest", "nearest")
  --MAKE SURE THE LAST NUMBER IS THE NUMBER OF FRAMES!!!
  saphir_animate_03 = newAnimation(saphir_canon_anim, 210, 254, 0.1, 21)
  
  --______________________________________________________________________
  --animation numbers are wrong
  saphir_rally_anim:setFilter("nearest", "nearest")
  --MAKE SURE THE LAST NUMBER IS THE NUMBER OF FRAMES!!!
  saphir_animate_04 = newAnimation(saphir_rally_anim, 163, 247, 0.1, 16)
end

function love.update(dt)
  animation1:update(dt)         
  animation2:update(dt)
  animation3:update(dt)
  saphir_animate_01:update(dt)
  saphir_animate_02:update(dt)
  saphir_animate_03:update(dt)
  saphir_animate_04:update(dt)

end

function love.draw()
  love.graphics.draw(back_ground, 0, 0)
  
  love.graphics.print("Press 1, 2, 3, or 4 to alternate between animations.", 50, 50)
  love.graphics.print(animationState_Effects, 50, 110)
  
  if state_of_saphir == "Effect_Saphir_1" then
    saphir_animate_01:setMode("loop")
    saphir_animate_01:draw(600, 150)    
    
  elseif state_of_saphir == "Effect_Saphir_2" then
    saphir_animate_02:setMode("once")
    saphir_animate_02:draw(580, 150)
    
    if saphir_animate_02:getCurrentFrame() == 21 then
      state_of_saphir = "Effect_Saphir_1"
      saphir_animate_01:reset()
      saphir_animate_01:play()  
    end
  end

  --______________________________________________________________________

  if animationState_Effects == "Effect_1" then
    animation1:setMode("once")
    animation1:draw(250, 250)
    
    if animation1:getCurrentFrame() == 110 then
      animationState_Effects = "Effect_0"
    end
       
  elseif animationState_Effects == "Effect_2" then
    animation2:setMode("once")
    animation2:draw(250, 250)
    
    if animation2:getCurrentFrame() == 80 then
      animationState_Effects = "Effect_0"
    end
    
  elseif animationState_Effects == "Effect_3" then
    animation3:setMode("once")
    animation3:draw(250, 250)
    
    if animation3:getCurrentFrame() == 80 then
      animationState_Effects = "Effect_0"
    end
          
  elseif animationState_Effects == "Effect_4" then
    state_of_saphir = "Effect_Saphir_2"          
  end  
end

function love.keypressed(key)
  if key == "1" then
    animationState_Effects = "Effect_1"
    animation1:reset()
    animation1:play()
    
  elseif key == "2" then
    animationState_Effects = "Effect_2"
    animation2:reset()
    animation2:play()
    love.audio.play(sound03)
    
  elseif key == "3" then
    animationState_Effects = "Effect_3"
    animation3:reset()
    animation3:play()
    love.audio.play(sound04)
  
  elseif key == "4" then
    state_of_saphir = "Effect_Saphir_2"
    saphir_animate_02:reset()
    saphir_animate_02:play()
       
  end
end
LOVE file:

https://www.dropbox.com/s/egel7f55aob3s ... .love?dl=0
Last edited by shatterblast on Fri Oct 24, 2014 4:42 pm, edited 1 time in total.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Loading Files from Another Folder

Post by Robin »

Rename the directory "safir_graphics" to "saphir_graphics". :)
Help us help you: attach a .love.
User avatar
shatterblast
Party member
Posts: 136
Joined: Tue Dec 11, 2012 9:47 pm
Location: Dallas, Texas, USA

Re: Loading Files from Another Folder

Post by shatterblast »

Robin wrote:Rename the directory "safir_graphics" to "saphir_graphics". :)
Oh gosh. Now I feel embarrassed. Thanks Robin.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 84 guests