Search found 78 matches

by mr_happy
Thu May 17, 2018 10:44 am
Forum: Support and Development
Topic: Why this error on love.event.quit() ?
Replies: 8
Views: 413

Re: Why this error on love.event.quit() ?

I don't see how line 149 is being executed after the call to love.event.quit(). love.event.quit() places a 'quit' event in the event queue. It does not terminate the program immediately. Use os.exit() for that. OK thanks. I thought it might be something to do with that but I thought it would most l...
by mr_happy
Thu May 17, 2018 10:02 am
Forum: Support and Development
Topic: Why this error on love.event.quit() ?
Replies: 8
Views: 413

Re: Why this error on love.event.quit() ?

Right, I've found what causes the error but not why it only happens when exiting with the keyboard. function love.keypressed(key) if key == 'escape' then love.event.quit() end -- HERE'S THE PROBLEM: local tX, tY = 0, 0 if key == "left" then tX = player.x - 1 tY = player.y end if key == "right" then ...
by mr_happy
Thu May 17, 2018 9:49 am
Forum: Support and Development
Topic: Why this error on love.event.quit() ?
Replies: 8
Views: 413

Re: Why this error on love.event.quit() ?

Can you post the whole code? I'd prefer not to at the moment as it contains the tiniest grain of an idea I'd like to keep to myself atm :D I moved if key == 'escape' then love.event.quit() end to the end of love.keypressed() but the result is exactly the same. I don't see how line 149 is being exec...
by mr_happy
Thu May 17, 2018 8:24 am
Forum: Support and Development
Topic: Why this error on love.event.quit() ?
Replies: 8
Views: 413

Why this error on love.event.quit() ?

In function love.keypressed() the first line is: if key == 'escape' then love.event.quit() end If I close the game window using the escape key I get this: Error: main.lua:149: attempt to index a nil value stack traceback: [string "boot.lua"]:637: in function '__index' main.lua:149: in function <main...
by mr_happy
Sun May 13, 2018 6:45 pm
Forum: General
Topic: Is this a good way to handle tile collision and generation?
Replies: 8
Views: 525

Re: Is this a good way to handle tile collision and generation?

(They look a little like they are circles joining. Maybe its coincidence) It's a little like that when run in its basic form but you can change various factors to radically alter the map. The game I was working on (before it began to get too complex!) used it to generate two continents with an ocea...
by mr_happy
Sun May 13, 2018 2:42 pm
Forum: General
Topic: Is this a good way to handle tile collision and generation?
Replies: 8
Views: 525

Re: Is this a good way to handle tile collision and generation?

The trouble with putting them in the map is it's more fiddly if you want to iterate through all or some of them (what if you wanted to change the status of all npcs?) plus you're probably going to have them in their own list anyway to store other info about them. As an aside, I've made a few dungeon...
by mr_happy
Sun May 13, 2018 12:33 pm
Forum: General
Topic: Is this a good way to handle tile collision and generation?
Replies: 8
Views: 525

Re: Is this a good way to handle tile collision and generation?

Each time you are about to move the player or npc just check that another entity doesn't have the same destination co-ords - as you're locking movement to a grid it's easy. As you say, keep your npc's coords in a table and iterate through it just before you move to check you're not trying to move in...
by mr_happy
Sun May 13, 2018 9:16 am
Forum: General
Topic: Rendering issue
Replies: 4
Views: 352

Re: Rendering issue

Thanks pgimeno, it just seems odd that the artefact is a 'white' line... I'd expect some sort of dithering of the black edge. No matter, easy enough to fix ;)
by mr_happy
Sun May 13, 2018 7:04 am
Forum: General
Topic: Rendering issue
Replies: 4
Views: 352

Re: Rendering issue

Drawing the sprite at non-integer coords? Yes indeed; if I use ints everything is fine. I just read this [1], which sort of explains it - the fix is certainly easy enough. I think my understanding of how/where images are drawn is flawed - I was expecting draw() to place the image at the nearest int...
by mr_happy
Sat May 12, 2018 6:16 pm
Forum: General
Topic: Rendering issue
Replies: 4
Views: 352

Rendering issue

Why does one edge of my, er, 'player' sprite (the green cube) sometimes display a white line alone one diagonal, whereas at other times is doesn't. There's only one place in the program where the image is drawn so it's not something I'm doing in code. Screenshot at 2018-05-12 18-40-05.png Screenshot...