jumping tutorial?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: jumping tutorial?
Please upload a .love file with what you have. I'll give it a look.
When I write def I mean function.
- toaster468
- Citizen
- Posts: 77
- Joined: Sat Nov 06, 2010 11:30 pm
Re: jumping tutorial?
I couldn't get the .zip turn into a .love so I just uploaded the .zip, sorry.
- Attachments
-
- Office.zip
- (3.28 KiB) Downloaded 85 times
- toaster468
- Citizen
- Posts: 77
- Joined: Sat Nov 06, 2010 11:30 pm
Re: jumping tutorial?
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.
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: jumping tutorial?
You just rename it from Office.zip to Office.love.toaster468 wrote:I couldn't get the .zip turn into a .love so I just uploaded the .zip, sorry.
- toaster468
- Citizen
- Posts: 77
- Joined: Sat Nov 06, 2010 11:30 pm
Re: jumping tutorial?
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.
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: jumping tutorial?
In Windows, I believe file extensions are hidden by default (annoying as all hell). I suggest you google on how to disable this.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.
- ishkabible
- Party member
- Posts: 241
- Joined: Sat Oct 23, 2010 7:34 pm
- Location: Kansas USA
Re: jumping tutorial?
or just use command prompt for a quick fix
$ rename Office.zip Office.love
$ rename Office.zip Office.love
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: jumping tutorial?
I've already downloaded the code and have started browsing it.
First impressions:
You can then remove the now unused line on love.load:
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.
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]
Code: Select all
tile_Y, tile_X = (map_h - player_Y)/tile_w, (map_w - player_X)/tile_h -- remove this
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.
Re: jumping tutorial?
Hello kikito and all the others,kikito wrote:
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!
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: jumping tutorial?
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.
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.
Who is online
Users browsing this forum: Bing [Bot] and 2 guests