Questions about platformer game

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.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Questions about platformer game

Post by Nixola »

What is it?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
gregkwaste
Prole
Posts: 19
Joined: Fri Aug 31, 2012 8:32 am

Re: Questions about platformer game

Post by gregkwaste »

Nixola wrote:What is it?
player.box=collider:addRectangle(blahblhablha)

In order to assign a player.box.player value, player.box must be a table, and it is not a table... I can't index it this way :/
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Questions about platformer game

Post by Nixola »

print(type(player.box)) afret player.box=collider:etc
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
gregkwaste
Prole
Posts: 19
Joined: Fri Aug 31, 2012 8:32 am

Re: Questions about platformer game

Post by gregkwaste »

Nixola wrote:print(type(player.box)) afret player.box=collider:etc

it prints out table :S:S:S i thought that it would print out shape..

But anyways its working now ^^. Although i didn't fully get what is going on here :S:S:S

i assigned a shape type (collider:addRectangle(etc)) in player.box

then i assigned player.box.player=player which means that i actually indexed a shape type :S:S:S:S

Except if collider:addRectangle produces tables and not shapes :? :? :?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Questions about platformer game

Post by Robin »

In Lua, basically everything is a table. HardonCollider (which I assume you're using) is written in Lua. Tables are really flexible.
Help us help you: attach a .love.
gregkwaste
Prole
Posts: 19
Joined: Fri Aug 31, 2012 8:32 am

Re: Questions about platformer game

Post by gregkwaste »

Robin wrote:In Lua, basically everything is a table. HardonCollider (which I assume you're using) is written in Lua. Tables are really flexible.
Didn't know that to be honest ^^. I just read the hardoncollider documentation concerning the shapes module, and thats why i discovered too, its indeed a table... And i do agree that they are flexible ^^.
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Questions about platformer game

Post by coffee »

gregkwaste wrote:
Robin wrote:In Lua, basically everything is a table. HardonCollider (which I assume you're using) is written in Lua. Tables are really flexible.
Didn't know that to be honest ^^. I just read the hardoncollider documentation concerning the shapes module, and thats why i discovered too, its indeed a table... And i do agree that they are flexible ^^.
Tables are essentially the core thing around all Lua is built. For successfully code in Lua you should start asap read and do even some Lua tutorials about tables. Unless you do that Lua/LOVE world and potentialities will stay "locked" for you.
User avatar
tv_user
Citizen
Posts: 57
Joined: Sun Aug 12, 2012 4:39 pm
Location: Portugal

Re: Questions about platformer game

Post by tv_user »

This book is all you need to know/learn about Lua programming. It was written by one of the founders of the language, and it is pretty easy and enjoyable to read. Buy it, borrow it, download it, steal it...heck, do what you want, but get a copy of it! :ultraglee:
Lua is built around the concept of flexibility, and that comes from the fact that it has only one data structure (yes, you guessed it...) - tables. variables are tables, arrays are tables, functions can be thought of as a cell in a table, even the entire program you write is a table.
Did my comment help/offended you? Use the Karma button!!
LÖVEing each day...
gregkwaste
Prole
Posts: 19
Joined: Fri Aug 31, 2012 8:32 am

Re: Questions about platformer game

Post by gregkwaste »

Thanks a lot for all the input, its an absolute relief for me that everything is a table just because i am very comfortable with using them and basicaly it was easy for me to understand everything as tables as well, and to be honest i definetely did not expect that EVERYTHING would be like that in lua ^^.

I'll try to get somehow this book and find out every detail i am missing ^^.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Questions about platformer game

Post by Roland_Yonaba »

gregkwaste wrote:Thanks a lot for all the input, its an absolute relief for me that everything is a table just because i am very comfortable with using them and basicaly it was easy for me to understand everything as tables as well, and to be honest i definetely did not expect that EVERYTHING would be like that in lua ^^.

I'll try to get somehow this book and find out every detail i am missing ^^.
Or eventually, read the free online version.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 2 guests