jumping tutorial?

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
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: jumping tutorial?

Post by kikito »

Please upload a .love file with what you have. I'll give it a look.
When I write def I mean function.
User avatar
toaster468
Citizen
Posts: 77
Joined: Sat Nov 06, 2010 11:30 pm

Re: jumping tutorial?

Post by toaster468 »

I couldn't get the .zip turn into a .love so I just uploaded the .zip, sorry.
Attachments
Office.zip
(3.28 KiB) Downloaded 82 times
User avatar
toaster468
Citizen
Posts: 77
Joined: Sat Nov 06, 2010 11:30 pm

Re: jumping tutorial?

Post by toaster468 »

I am almost certain it is because it only checks for collisions one per event so if you collide with a block before the event ends it wouldn't know.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: jumping tutorial?

Post by nevon »

toaster468 wrote:I couldn't get the .zip turn into a .love so I just uploaded the .zip, sorry.
You just rename it from Office.zip to Office.love.
User avatar
toaster468
Citizen
Posts: 77
Joined: Sat Nov 06, 2010 11:30 pm

Re: jumping tutorial?

Post by toaster468 »

I tried but it named it "Office.love.zip" I know there is a setting to change this some where but I do not know where.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: jumping tutorial?

Post by nevon »

toaster468 wrote:I tried but it named it "Office.love.zip" I know there is a setting to change this some where but I do not know where.
In Windows, I believe file extensions are hidden by default (annoying as all hell). I suggest you google on how to disable this.
User avatar
ishkabible
Party member
Posts: 241
Joined: Sat Oct 23, 2010 7:34 pm
Location: Kansas USA

Re: jumping tutorial?

Post by ishkabible »

or just use command prompt for a quick fix
$ rename Office.zip Office.love
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: jumping tutorial?

Post by kikito »

I've already downloaded the code and have started browsing it.

First impressions:
  • Whitespace usage wasn't consistent. As a result, an "if" closed didn't himself an also the function that contained it, causing lots of problems. The code doesn't error by sheer luck. Go over your text, and make sure that each "if" and each "function" has a matching "end". Being strict with your spacig is really important.
  • Your character, although nicely drawn, is bigger than your minimal tile. This will cause problems with collision detection. Make your tiles bigger than your character in order to avoid that.
  • Why did you set up such a small window? Remove the love.graphics.setMode( 320, 320 ) line and you will get a bigger one.
  • This is anecdotal, but 'Up' moves the character 'down' and viceversa.
  • Finally, tile_X and tile_Y are wrong. You should calculate them as I said, (using world2map) inside love.update:

Code: Select all

local tileX, tileY = world2map( player_X, player_Y )
local leftTileX, leftTileY = tileX - 1, tileY
local leftTileNo = map[leftTileY][leftTileX]
You can then remove the now unused line on love.load:

Code: Select all

tile_Y, tile_X = (map_h - player_Y)/tile_w, (map_w - player_X)/tile_h -- remove this
It has already happened that you have been confused by variables that you thought you should be using, but you should not. It's my fault, the tile scrolling tutorial is to blame for that, I shouldn't have recommended it.

In addition to re-checking the spacing and ifs and functions and ends, it would help you to go through the code and identify those variables that are not really needed - and erase them if they are not. This way you will get less confused in the future.

It would also help you to print the map coordinates of the player on the screen, instead of the mouse coordinates.

This is all I could find for now. When you do all these changes, update the file again.
When I write def I mean function.
User avatar
qrux
Prole
Posts: 28
Joined: Thu Nov 03, 2011 1:11 am

Re: jumping tutorial?

Post by qrux »

kikito wrote:
Hello kikito and all the others,
i have found this thread more useful than any other tutorial online, so i wonder if you have thought about writing the last parts of the "guide" and then publish it (maybe here on the forum)? It's great because you actually learn something as opposed to other tutorials where they just give you the code and tell you what is what.

Thank you!
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: jumping tutorial?

Post by kikito »

I actually started doing that.

But never finished. :(

It was ... too time consuming and difficult! More than programming, at least for me. I might continue it in the future, but I can provide no dates. Sorry.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests