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: 1940
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Questions about platformer game

Post by Nixola » Mon Sep 10, 2012 2:46 pm

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 » Mon Sep 10, 2012 2:51 pm

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: 1940
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Questions about platformer game

Post by Nixola » Mon Sep 10, 2012 3:00 pm

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 » Mon Sep 10, 2012 3:18 pm

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 » Mon Sep 10, 2012 3:27 pm

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 » Mon Sep 10, 2012 3:31 pm

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 » Tue Sep 11, 2012 3:08 am

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 » Tue Sep 11, 2012 9:15 pm

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 » Tue Sep 11, 2012 10:41 pm

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 » Wed Sep 12, 2012 10:05 am

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: No registered users and 37 guests