## Tilt - physics puzzler (r11)

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

### Tilt - physics puzzler (r11)

You know those labyrinth things? The ones where you tilt the thingy around to get the ball to go around holes? OK, well imagine a 2D computer game version of that. Where all of the platforms rotate separately. And you can only rotate the one that the ball touched last.

(or just use the attachment)

How to play: hold down the left mouse button and move the mouse to rotate platforms. Get the ball to the green square. Don't go past the left, right, or bottom edge of the screen. Avoid spikes.

__________________________________________________________________________________________________________________________________

Level making guide
Hey guess what, in the current release, you can make levels!

First create a text file in the "custom" folder with the file extension ".tilt". Then start typing in it!
(The "custom" folder is in %appdata%/love/tesselode_tilt on Windows and ~/.love/tesselode_tilt on LInux.)

Each line is a different object. The syntax is as follows:

[x position],[y position],[object type],[parameters for object separated by commas]

The different object types:
-"ball" - the ball you have to guide to the goal (no parameters)
-"goal" - the goal you have to guide the ball to (no parameters)
-"spike" - spike balls. Don't touch these! (no parameters)
-"wall" - uninteractive wall thingy. (no parameters)
-"platform" - a rotatable platform. This can have one or more sets of 4 parameters, each of which represents a rectangle that makes up the platform.
The parameters are, in order: relative x position, relative y position, width, and height.
-"spring" - the ball bounces when it lands on one of these. (no parameters)
-"jet" - an air jet that pushes the ball around. Has 1 parameter, which is one of four directions, "left," "right," "up," or "down."

Tips:
-The size of every level is 800 by 600 pixels.
-Don't let platforms rotate too far off the screen. Otherwise they might stop rotating.
-Try not to let platforms collide with each other. Bad stuff isn't guaranteed to happen, but weird stuff might.
-All the shapes on a platform should touch each other. We don't want floaty shapes.
-Walls, spike balls, and springs all have a size of 30x30 pixels.

Feel free to post level designs in this topic! I would like people besides me to design some levels for the final version of Tilt, since that will probably make the game more interesting.
Attachments
tilt-r11.love
Last edited by Tesselode on Sat Oct 02, 2010 7:36 pm, edited 13 times in total.

TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

### Re: Tilt - physics puzzler

I assume it stops because of garbage collection.
Also, the x-axis/y-axis controls seem to do the same thing.

Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

### Re: Tilt - physics puzzler

I've heard a lot about the garbage collector. What exactly does it do, and how can I get it to stop screwing up the movement (if it is)?

kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Contact:

### Re: Tilt - physics puzzler

"garbage" on this context means "things that are not referenced by variable".

Lua understands that an object stops being used when the last reference to it is removed from memory. The garbage collector is a periodical process that goes through all the lua objects in your app and deletes them from memory if they are not referenced.

For example:

Code: Select all

local a = {'a','b','c'} -- the table is created and referenced by the 'a' variable
local b = a -- now it has two references: a and b
a = nil -- the table only has one reference now: b
b = nil -- the table isn't referenced any more
-- from this point on, the table can be garbage-collected

Technocat means that when you create your physical objects you are probably not assigning them to any variable - you are probably "just leaving them there", like this:

Code: Select all

   love.physics.newBody(...)

So when the garbage collector is fired, it detects that the body isn't referenced, and eliminates it from memory. If you don't want this to happen, assign it to a global variable or insert it on a global array, like so:

Code: Select all

   body1 = love.physics.newBody(...)

When I write def I mean function.

Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

### Re: Tilt - physics puzzler

I am assigning the bodies to variables. I don't think the garbage collector is the problem, as the rotation stops working at different times. In fact, if I don't move the mouse at all and I wait for the ball to land on the platform, the rotation always stops working. I'm thinking this might have something to do with body:setAngularVelocity.

bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

### Re: Tilt - physics puzzler

Or maybe the bodies fall asleep?

Xkeeper
Prole
Posts: 40
Joined: Wed Aug 04, 2010 2:49 am
Contact:

### Re: Tilt - physics puzzler

Yes, the objects go to sleep.

This is easily fixable:

Code: Select all

function love.load()
world=love.physics.newWorld(love.graphics.getWidth(),love.graphics.getHeight())
world:setGravity(0,500)
world:setAllowSleep(false);
...
That will make it so no objects go to sleep.

osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

### Re: Tilt - physics puzzler

Ah, that's original. I think you have plenty of opportunities for interesting puzzles if you do not restrict yourself to only and always being able to rotate platforms. You could also make e.g. platforms that can be moved along a pre-designed path or tatic ones that cannot be moved at all. Complicated pieces involving several objects through joints, e.g., a motorless obstacle attached to a platform by a rope. It might also be fun to involve more than one ball. One design question is whether there will be any direct ball interaction, e.g. the player slowing it down on a platform, or simply having to be quick about moving the platform before the ball touches something else.

Only having <-type platforms that can be rotated is not enough in itself to create a puzzle because, on the logical side, the vertex space is roughly equal to the number of platforms and hence easy. On the other hand, it can be still be a most challenging game since it requires a good eye, reflexes, and skillful control.
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.

Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

### Re: Tilt - physics puzzler

http://tesselode.110mb.com/games/tilt.zip

I'm trying to get a level creation system started, and it's currently broken. You'll probably get the following error:

scripts/loadlevel.lua:56: 'for' limit must be a number

If anyone can help me fix it, that would be great. And there will probably be more errors after that, so don't hurt yourself trying to fix those. Also, I'm attaching the .love file to make your lives easier, but knowing the forum, the link will break in a day or two.
Attachments
tilt.love

giniu
Party member
Posts: 221
Joined: Mon Nov 30, 2009 4:44 pm

### Re: Tilt - physics puzzler

Tesselode wrote:Just uploaded a new version.

http://tesselode.110mb.com/games/tilt.zip

I'm trying to get a level creation system started, and it's currently broken. You'll probably get the following error:

scripts/loadlevel.lua:56: 'for' limit must be a number

If anyone can help me fix it, that would be great. And there will probably be more errors after that, so don't hurt yourself trying to fix those. Also, I'm attaching the .love file to make your lives easier, but knowing the forum, the link will break in a day or two.
well, add print before it to see what's up - you will see that the shape_amount[a] is nil. It means you don't set it up correctly. Look at

Code: Select all

if object_type=="platform" then
object_type is a list, so something isn't right here, correct?

### Who is online

Users browsing this forum: No registered users and 20 guests