No it won't. The only broken links are from before the Attack of the Aliens, which started out as the web site being split and later being down completely, after which most posts were recovered, but attachments were not.Tesselode wrote:the link will break in a day or two.
Tilt - physics puzzler (r11)
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Tilt - physics puzzler
Help us help you: attach a .love.
Re: Tilt - physics puzzler
I hope you don't mind if I play a bit with it -- it will be kind of fun to see what else I can do (and maybe help you out, who knows).
I'll also see if I can figure out what went wrong.
I'll also see if I can figure out what went wrong.

- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Tilt - physics puzzler

That code... hurts.
The real problem lies in the loop which starts on line 15 (“for line in file:lines() do ...”). You see, objectnum is always incremented (I'd rather you'd do away with it completely), even if the object_type is not "platform". Hilarity does not ensue.
Especially since (rolling drums) object_type is NEVER "platform". Because it's a table.
Code: Select all
object_type[objectnum]=string.sub(currentline,1,string.find(currentline,",")-1)
if object_type=="platform" then
Code: Select all
if object_type[objectnum] == "platform" then
Help us help you: attach a .love.
Re: Tilt - physics puzzler
hehe, look at last post on previous pageRobin wrote:Especially since (rolling drums) object_type is NEVER "platform". Because it's a table.



- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Tilt - physics puzzler
Oh, sorry, I didn't see that.giniu wrote:hehe, look at last post on previous page![]()

Help us help you: attach a .love.
Re: Tilt - physics puzzler
Thanks guys. Anyway, errors ahoy. It would be great if you could fix this new error, and if you find any other ones, feel free to fix them too if it doesn't hurt you too much.
Seriously, what does indexing a field mean?
P.S. - The code is now commented for both my sake and everyone else's sake. Hopefully this will make it easier to tell what's supposed to be going on.
(It should also make it easier for XKeeper to play around with it.)
Seriously, what does indexing a field mean?
P.S. - The code is now commented for both my sake and everyone else's sake. Hopefully this will make it easier to tell what's supposed to be going on.
(It should also make it easier for XKeeper to play around with it.)
- Attachments
-
tilt-r3.love
- (1.73 KiB) Downloaded 116 times
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Tilt - physics puzzler
It means doing field.something or field[something_else].Tesselode wrote: Seriously, what does indexing a field mean?
EDIT: also field:something_completely_different()
When I write def I mean function.
Re: Tilt - physics puzzler
Looking through this, I'm going to try to work on it a bit and do some stuff.
My thoughts so far, though:
You're using arrays backwards. It would be wiser to do this:
This way, you can create a new object easily by manipulating only one array, and to destroy it is easily similar (objects[id] = nil).
I'm going to clean it up a bit for you, hopefully simplifying the LoadLevel routine too for you. Stay tuned
My thoughts so far, though:
Code: Select all
object_x={}
object_y={}
object_type={}
Code: Select all
objects[1]['x'] = (object x)
objects[1]['y'] = (object y)
objects[1]['type'] = (etc)
objects[2]['type'] = ....
I'm going to clean it up a bit for you, hopefully simplifying the LoadLevel routine too for you. Stay tuned

- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Tilt - physics puzzler
Something that's better to avoid is using global variables as loop counters.
Almost. It's easier to type objects[1].x than objects[1]['x'], while they mean exactly the same thing.Xkeeper wrote:You're using arrays backwards. It would be wiser to do this:
Code: Select all
objects[1]['x'] = (object x) objects[1]['y'] = (object y) objects[1]['type'] = (etc) objects[2]['type'] = ....
Help us help you: attach a .love.
Re: Tilt - physics puzzler
I agree. Though I'm curious, and this has always bugged me about Lua; if you manage your global variables carefully (to only things that really need to be global), is there a downside to omitting local within functions/loops? Especially for temporary values that are set and only used after that point.Robin wrote:Something that's better to avoid is using global variables as loop counters.
D'oh, true. I come from PHP-land so ... yeah.Almost. It's easier to type objects[1].x than objects[1]['x'], while they mean exactly the same thing.
Who is online
Users browsing this forum: No registered users and 4 guests