Tilt - physics puzzler (r11)

Show off your games, demos and other (playable) creations.
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Tilt - physics puzzler

Post 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?
User avatar
Xkeeper
Prole
Posts: 40
Joined: Wed Aug 04, 2010 2:49 am
Location: Henderson, Nevada, US
Contact:

Re: Tilt - physics puzzler

Post 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;
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Tilt - physics puzzler

Post by Jasoco »

I'm getting an error on line 27 of loadlevel.lua. Attempt to index field.
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Tilt - physics puzzler

Post 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.
User avatar
Xkeeper
Prole
Posts: 40
Joined: Wed Aug 04, 2010 2:49 am
Location: Henderson, Nevada, US
Contact:

Re: Tilt - physics puzzler

Post 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.

Image
Download
...

So, yeah. I kind of rewrote most of it (staying up until 4 AM when I should've been in bed at midnight :x).


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. :crazy:


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.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Tilt - physics puzzler

Post 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. :nyu:
Help us help you: attach a .love.
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Tilt - physics puzzler

Post 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.
Attachments
tilt-r4.love
(1.7 KiB) Downloaded 88 times
User avatar
Xkeeper
Prole
Posts: 40
Joined: Wed Aug 04, 2010 2:49 am
Location: Henderson, Nevada, US
Contact:

Re: Tilt - physics puzzler

Post 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 :P). 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.
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Tilt - physics puzzler

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

Re: Tilt - physics puzzler

Post 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. ;)
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 0 guests