Battle Cry v0.1.3 - Depth, Camera, Ghost!

Show off your games, demos and other (playable) creations.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Battle Cry v0.1.1

Post 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 ?
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Battle Cry v0.1.1

Post 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
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Battle Cry v0.1.1

Post by Davidobot »

I got an error while trying to quit on Windows 7 x64
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Battle Cry v0.1.1

Post 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?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Battle Cry v0.1.1

Post 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.
When I write def I mean function.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Battle Cry v0.1.1

Post 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).
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Battle Cry v0.1.1

Post 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!
When I write def I mean function.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Battle Cry v0.1.1

Post 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.
Help us help you: attach a .love.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Battle Cry v0.1.1

Post 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.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Battle Cry v0.1.1

Post 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!
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests