Tetris style view screen + conveyor belt physics

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Ary
Prole
Posts: 1
Joined: Fri Feb 04, 2011 1:47 pm

Tetris style view screen + conveyor belt physics

Post by Ary »

Hi guys my name is Ary, I am a contract game designer living in Guildford England.
I am typically an 3d Engine based designer but I am currently trying to up my skill-set by picking up more scripting ala LUA.

So I have set myself a 1 week project to make a mini game.

This is based around a character running & jumping across 2 conveyor belts. Delivering specific objects to a chute by pulling on a chord above (this raises a section of platform 45 degrees and allows objects to continue rolling into the chute.

There are a couple of things I wonder if anyone has done here in the forums.

First off, conveyor belt physics:

I am looking to create a static platform in the air, however, if the player or any other physics objects are on the platform, they are pushed in a specific direction. Is that an easy thing to do with LUA?

Secondly (the Tetris view cube) This is essentially a square in the top left corner that displays the next shape about to drop. This links into the objects that I want falling off the conveyor belt.

I promise cake to any of you LUA master that may help out in this project.

Happy Friday :awesome:
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Tetris style view screen + conveyor belt physics

Post by kikito »

Hi there!

First, a word of warning - don't get near the physics module. You don't seem to need it for your game - specially if your pieces have to be permanently axis-aligned, like in tetris.
Ary wrote:if the player or any other physics objects are on the platform, they are pushed in a specific direction.
That part, by itself, isn't quite complicated. I would even hesitate to call it 'physics'. [assumption]Since your conveyour belts are static[/assumption], you can just check the coordinates of your player / objects against the coordinates of your conveyor belts. On your update function, if they 'touch', you just move the player/pieces slightly (conveyorVelocity * dt pixels)
Ary wrote:Secondly (the Tetris view cube) This is essentially a square in the top left corner that displays the next shape about to drop. This links into the objects that I want falling off the conveyor belt.
I'm not sure what is the question there. If you just forgot to write "how do I do that in Lua", the answer is - you store a value representing your next shape (i.e. 1 is a cube, 2 is a square, etc) inside a variable. Name it nextShape, or something similar. If you need several shapes (you're displaying the next 'n' pieces on your 'square') it's a bit less simple - you have to use a table. You push the value representing the newest element at the beginning, and 'pop' the oldest one from the end.

Happy Coding! ^^
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest