Author Topic: [possible bug] Fatal: Cannot load image 'sprites/'  (Read 5202 times)

0 Members and 1 Guest are viewing this topic.

jurassicjordan
  • Newbie
  • *
  • Posts: 1
    • View Profile
[possible bug] Fatal: Cannot load image 'sprites/'
« on: March 23, 2018, 12:34:59 AM »
when setting the tunic in a directory other than hero, for ex: main_heroes, the game tester crashes. I have no idea why, I'm trying to change sprites upon entering a map, in the map's lua file, i set the tunic sprite id to a sprite in the main heros folder, upon testing, the whole thing crashed, is this a bug on my part or on solarus's part? thx
report, code, and log is attached

Diarandor

  • Hero Member
  • *****
  • Posts: 1062
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: [possible bug] Fatal: Cannot load image 'sprites/'
« Reply #1 on: March 23, 2018, 11:24:04 AM »
Do you get an error in the file "error.txt"?
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

Lucifer
  • Guest
Re: [possible bug] Fatal: Cannot load image 'sprites/'
« Reply #2 on: March 24, 2018, 08:19:30 AM »
In scripts\meta\hero.lua, you must change :
Code: ( lua) [Select]
-- Initialize hero behavior specific to this quest.

require("scripts/multi_events")

local hero_meta = sol.main.get_metatable("hero")

local function initialize_hero_features(game)

  local hero = game:get_hero()
  hero:set_tunic_sprite_id("main_heroes/eldran")
end

-- Set up Eldran hero sprite on any game that starts.
local game_meta = sol.main.get_metatable("game")
game_meta:register_event("on_started", initialize_hero_features)
return true

by :

Code: ( lua) [Select]
-- Initialize hero behavior specific to this quest.

require("scripts/multi_events")

local hero_meta = sol.main.get_metatable("hero")

local function initialize_hero_features(game)

  local hero = game:get_hero()
  hero:set_tunic_sprite_id("that you want")
end

-- Set up Eldran hero sprite on any game that starts.
local game_meta = sol.main.get_metatable("game")
game_meta:register_event("on_started", initialize_hero_features)
return true


boaromayo

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • | boaromayo
Re: [possible bug] Fatal: Cannot load image 'sprites/'
« Reply #3 on: September 10, 2018, 09:44:39 PM »
I have a similar issue too.

Whenever I select the second scene from my demo (there's two scenes to choose from), it's supposed to change the hero's sprite to my custom sprite. But, after I select the scene, I get a prompt saying "Fatal: Cannot open data file 'sprites/'".

Here's my code that's producing the error, from "scripts\game_manager.lua":

Code: ( lua) [Select]
-- Code producing game crash.

  function game:initialize_hero()
    local hero = game:get_hero()
    if cursor == 1 then
      hero:set_tunic_sprite_id("main_heroes/eldran")
    elseif cursor == 2 then
      --hero:set_tunic_sprite_id("hero/den_boy") <-- Whenever I set the sprite id to "den_boy", the game crashes. Every other sprite works fine.
      hero:set_tunic_sprite_id("main_heroes/robyne")
    end
  end

I also get no "error.txt" file stating the issue.

Is this a bug in Solarus itself?

Or does it have something to do with my custom sprite having the wrong sizes? My custom sprite is 24x32 per frame.
« Last Edit: September 10, 2018, 09:50:54 PM by boaromayo »

Diarandor

  • Hero Member
  • *****
  • Posts: 1062
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: [possible bug] Fatal: Cannot load image 'sprites/'
« Reply #4 on: September 10, 2018, 10:56:15 PM »
-Yes, it seems a bug to me. The Editor should give an error without crashing.
-Your sprites can have any size.
-Could you share the ".dat" file of the sprite here? There may be something wrong there, or something missing that is required by the engine.
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

boaromayo

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • | boaromayo
Re: [possible bug] Fatal: Cannot load image 'sprites/'
« Reply #5 on: September 11, 2018, 07:45:36 AM »
Thanks for responding quickly!  :)

The .dat file for the sprite's attached below.

Diarandor

  • Hero Member
  • *****
  • Posts: 1062
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: [possible bug] Fatal: Cannot load image 'sprites/'
« Reply #6 on: September 11, 2018, 08:34:03 AM »
Your "sword" animation has no source image. That may be the problem. Also, many of your animations have no directions, which might not be allowed by the engine (I don't know).
« Last Edit: September 11, 2018, 10:29:49 AM by Diarandor »
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

boaromayo

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • | boaromayo
Re: [possible bug] Fatal: Cannot load image 'sprites/'
« Reply #7 on: September 11, 2018, 09:31:18 PM »
I added in the directions for all of the animations for my sprite and it worked.

Thanks for the help again!