Page 3 of 5
Re: Tilt - physics puzzler
Posted: Thu Aug 05, 2010 12:47 am
by Tesselode
Lua hates something about this line of code:
Code: Select all
object[objectnum].x=string.sub(currentline,1,string.find(currentline,",")-1)
scripts/loadlevel.lua:8: attempt to index field '?' (a nil value)
Anyone?
Re: Tilt - physics puzzler
Posted: Thu Aug 05, 2010 12:56 am
by Xkeeper
Tesselode wrote:Lua hates something about this line of code:
Code: Select all
object[objectnum].x=string.sub(currentline,1,string.find(currentline,",")-1)
scripts/loadlevel.lua:8: attempt to index field '?' (a nil value)
Anyone?
When adding one:
Code: Select all
object = {};
for <loading loop> do
object[i] = {
x = object x,
y = object y,
etc = etc,
}
end;
Re: Tilt - physics puzzler
Posted: Thu Aug 05, 2010 1:30 am
by Jasoco
I'm getting an error on line 27 of loadlevel.lua. Attempt to index field.
Re: Tilt - physics puzzler
Posted: Thu Aug 05, 2010 2:38 am
by Tesselode
Jasoco wrote:I'm getting an error on line 27 of loadlevel.lua. Attempt to index field.
Yup, that's the one I was talking about. But expect to see a cleaned up, fixed version soon. Hopefully.
Re: Tilt - physics puzzler
Posted: Thu Aug 05, 2010 11:06 am
by Xkeeper
Eh I'll take a look at it and maybe fudge around with the values a bit, make stuff into a neat array and make it OH JESUS HOW DID THIS GET HERE I AM NOT GOOD AT SLEEPING.
Download
...
So, yeah. I kind of rewrote most of it (staying up until 4 AM when I should've been in bed at midnight
).
Now it's a game where you try to keep the balls in the air for points! ... or something. I don't know, I'm too tired to think.
The source is (mostly) commented so you can at least tell what changed as well as some thoughts for future changes. If nothing else, at least it's fun to play with.
Re: Tilt - physics puzzler
Posted: Thu Aug 05, 2010 11:50 am
by Robin
Oh, man this is so much fun. I managed to get a score of over 44.000, by keeping one ball for over 280 seconds.
Re: Tilt - physics puzzler
Posted: Thu Aug 05, 2010 2:59 pm
by Tesselode
Wow, that's an abomination!
Enough of one to become an easter egg.
Well, here's r4. It's actually working! But it doesn't do much yet. Hopefully I'll be able to make a cleaner version that is actually useful soon.
Re: Tilt - physics puzzler
Posted: Thu Aug 05, 2010 3:02 pm
by Xkeeper
Hmm, did you take a look at the source to mine?
The "game" part of it is literally all in the update code, but the rest of it should still be useful for you; it's a lot cleaner.
Even the "level" is technically just two platforms and several balls, using the same format you did (albeit with support for the ball object and some other stuff).
Oh, man this is so much fun. I managed to get a score of over 44.000, by keeping one ball for over 280 seconds.
I got 77,131 by keeping one for 360
It's even better when you can manage to keep a few 20+ balls on by juggling them, too.
It's surprisingly fun for being such a silly demo.
As a side note, it's pretty easy to get a
massive score if you park the platforms in a specific alignment (hint: top center
). It might take a while for it to kick in, but if done right they'll stay still for quite some time. Feels like cheating, though, since it takes away from the spirit of having to balance.
Re: Tilt - physics puzzler
Posted: Thu Aug 05, 2010 4:08 pm
by Tesselode
I'm not a big fan of digging through source code, because then I would have to figure out how everything works, when I could just write some myself and immediately know how it works. But now that I think about it, I'm not sure which one would take more work...
I'll look at your code, although I'm pretty close to having mine done. And thanks for the advice about objects.
Re: Tilt - physics puzzler
Posted: Thu Aug 05, 2010 8:46 pm
by Robin
Tesselode wrote:I'm not a big fan of digging through source code, because then I would have to figure out how everything works, when I could just write some myself and immediately know how it works. But now that I think about it, I'm not sure which one would take more work...
Reading and writing code are both vital skills --- if you look at the code you wrote now six months in the future, you'd have to read it like it was written by someone else. Code shouldn't be write-only.