Page 2 of 3

Re: Battle Cry v0.1.1

Posted: Wed May 09, 2012 5:38 pm
by Roland_Yonaba
kikito wrote: The black holes are not walls, but "holes in the ground" (Obviously! How could you possibly make that mistake? I might need an artist). Everything with working eyes should see through them. That's why my next thing should be a flying thing - to test that.
Oh :death: :death:
Sorry. I saw walls.
Then everything's fine.
kikito wrote: but flying things should.


ha ha ?

Re: Battle Cry v0.1.1

Posted: Thu May 10, 2012 9:50 am
by miko
kikito wrote:Hi,

This is the forum post where I will be writing about my latest attempt at making a game. It's name, for now, is Battle Cry.
I get this error on linux:

Code: Select all

Error: error loading module 'lib.require_dir' from file './lib/require_dir.lua':
	./lib/require_dir.lua:2: invalid escape sequence near '''
This fixed it:

Code: Select all

local function toRequirePath(fsPath)
  --return fsPath:gsub('\.lua',''):gsub('\/','.')
  return fsPath:gsub('%.lua',''):gsub('%/','.')
end

Re: Battle Cry v0.1.1

Posted: Thu May 10, 2012 2:00 pm
by Davidobot
I got an error while trying to quit on Windows 7 x64

Re: Battle Cry v0.1.1

Posted: Thu May 10, 2012 5:47 pm
by bartbes

Code: Select all

local function toRequirePath(fsPath)
  --return fsPath:gsub('\.lua',''):gsub('\/','.')
  return fsPath:gsub('%.lua',''):gsub('%/','.')
end
Wait, seriously? So not only is this pattern wrong, and too greedy (that should be "%.lua$"), but it seems like a pure hack, why not just use correct paths?

Re: Battle Cry v0.1.1

Posted: Thu May 10, 2012 9:22 pm
by kikito
bartbes wrote:Wait, seriously? So not only is this pattern wrong, and too greedy (that should be "%.lua$"), but it seems like a pure hack, why not just use correct paths?
The "troublesome" file is require_dir.lua.

In a couple places it is just convenient to be able to include a whole directory without having to list all its files one by one. If I have understood correctly, love.filesystem is the only valid way to parse a dir. But love.filesystem expects slashes and files ending in .lua, while require uses dots and no extension. So I guessed I had to transform one into the other.

But this was a hack, I did it in like 5 minutes. If you have better alternatives, I'm all ears.

In the meantime, I think I have fixed the escapes.

Re: Battle Cry v0.1.1

Posted: Thu May 10, 2012 9:40 pm
by bartbes
Hmm, fair enough, I usually place that in the init.lua, though. Anyway, you should definitely add the $ (so it will only replace ".lua" on the end).

Re: Battle Cry v0.1.1

Posted: Thu May 10, 2012 10:01 pm
by kikito
bartbes wrote:Hmm, fair enough, I usually place that in the init.lua, though. Anyway, you should definitely add the $ (so it will only replace ".lua" on the end).
Thanks, done!

Re: Battle Cry v0.1.1

Posted: Fri May 11, 2012 9:26 am
by Robin
When loading a while directory, I would use love.filesystem.load()() rather than require(). That way, no hacks necessary.

Of course, then you need to think about when you call it, instead of relying on require()'s caching behaviour.

Re: Battle Cry v0.1.1

Posted: Fri May 11, 2012 9:35 am
by bartbes
Robin wrote:Of course, then you need to think about when you call it, instead of relying on require()'s caching behaviour.
That's why I use require, so if a file in it does have dependencies, it can just require that and will be fine.

Re: Battle Cry v0.1.1

Posted: Fri May 11, 2012 11:23 am
by kikito
Robin wrote:When loading a while directory, I would use love.filesystem.load()() rather than require(). That way, no hacks necessary.
It's not really a hack - it's just string manipulation - and not very complex (for being Lua). Once it is conveniently hidden away in a function, it doesn't bother me.
Robin wrote:Of course, then you need to think about when you call it, instead of relying on require()'s caching behaviour.
That's something I'd rather not do. But I understand if you prefer it the other way around.

----

UPDATE: 0.1.2 is out

Changes are:
  • Kadoba has redone all the graphics! They look much better than before! :ultraglee: Thanks Kadoba!
  • He also has made a cool flying monster - a purple pterodactyl wearing sunglasses!
  • We also nave a scared mind, which gets runs away from its "subject" if it sees it. The pterodactyl uses that mind now, and flies away from the player.
It is very easy to change things. For example, one can make the pterodactyl follow the player, and the guy at the bottom could be scared of the pterodactyl. That involves changing 6 lines, 4 of which are requires.

The new version and screenshot are on the OP.

I'll now concentrate on z-sorting. Kadoba has made some interesting changes on the tiles that I'm eager to put to use! Then, the Camera system.

But for now, good night!