"Questions that don't deserve their own thread" thread

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.
Locked
ELFUERTE
Prole
Posts: 7
Joined: Fri Sep 12, 2014 2:29 pm

Re: "Questions that don't deserve their own thread" thread

Post by ELFUERTE »

Zilarrezko wrote:
ELFUERTE wrote:Hey it's me again. You guys helped me solve that problem,maybe you can help me again. So I'm using advanced tile loader,and to move my character I use the function moveTile wich,obviusly, moves my character of a single tile unit. Since the user must move the character,I've used the .isDown function. But ,the character moves waaaaaaaaaaaaaaay too fast now. Link to the love file. PLEASE NOTE:DOUBLE CLICKING THE LOVE FILE WONT WORK. IF YOU EXTRACT THE CODE AND RUN IT TROUGHT LOVE.EXE TOUGH,IT WORKS.
Okay, I just wrote an entire essay explaining something wrong with something you didn't want fixed and that didn't have to do with anything you asked for. And whan I tried to fix what I thought you wanted, I realized it wasn't what the problem was :cry: So here I'm retyping another.

Alrighty! So your problem that you want fixed is in your mobs.lua file in the boy.keypressed function... There are two possible fixes, depending on how you want to implement them. I'll create two variations of the "Boy.keypressed" functions. But here i'll explain them.

First: You can keep the style you were going for in the first one. Moving the player without having to lift up the key per interval (you were doing it per frame in the treeLevel file, that's why he was moving very fast). To accomplish this, I put a Boy.movementTimer and Boy.movementTimerLimit at the top of mobs.lua. Then every frame when it calls the Boy.Update(dt) I put in the love.update function, it will add dt to Boy.movementTimer, and when Boy.movementTimer is greater than Boy.movementTimerLimit, it will move the player if the keys that move the player are down, then subtracting Boy.movementTimerLimit to Boy.movementTimer so that way there's a consistent update, so that way you won't get 2 updates in one second, and 1 update in another second (not very consistent, but it makes me feel special).

Second: You can go with what you had in the main.lua's love.keypressed, and do key presses instead of checking to see if a button is down every timer interval. You will have to press a key everytime you want to move, but it's the simplest implication.

Here's the .love's. Choose, your, path
I cannot stress enough about how great you guys are. Really, I'm learning so much. The second possible solution is what I was using before,but it didnt work as I wanted. I had tought of the first solution,but I didn't know how to actaully implement it and I tought it wasnt optimal. Btw what's the other problem? And thanks a lot again for your time :oops: .
User avatar
Ortimh
Citizen
Posts: 90
Joined: Tue Sep 09, 2014 5:07 am
Location: Indonesia

Re: "Questions that don't deserve their own thread" thread

Post by Ortimh »

Same as ELFUERTE, I can't open my own *.love file using LÖVE program. I'm putting the main.lua at the root of directory. I'm using WinRAR to create *.love file. Is WinRAR the problem or I need to create conf.lua to make it works?
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: "Questions that don't deserve their own thread" thread

Post by Zilarrezko »

Ortimh wrote:Same as ELFUERTE, I can't open my own *.love file using LÖVE program. I'm putting the main.lua at the root of directory. I'm using WinRAR to create *.love file. Is WinRAR the problem or I need to create conf.lua to make it works?
I don't actually think you need a conf.lua actually. To be honest, it's better for you to throw up the .love to point out what exactly is wrong.

But, let me try to explain it here. If you do it like I do. In the main.lua you require your files. Let's just call where the main.lua the "main directory" for the sake of terms. From your main directory, you should have your conf.lua, if you have it, I don't think you need to have it to run the game. Then you have your requires in folders, like bin and utils and assets or whatever you use for whatever purpose then you use the "require 'bin/taco'" to load up the taco.lua in the bin folder. What you want to do is position the main.lua in relation to how you require everything and load files. So, if you require "bin/taco" in your main.lua, you should make sure the bin folder is in the same directory as the main.lua.

To build it into a .love, you select everything in the main directory, where the main.lua is, and zip it with, winrar, or 7zip. (I'll assume you use either windows or OSX and not linux.) then, change the extension of the .zip to .love. Then the Icon for the zip should change to löve's logo and it will now be a .love file. Should be able to double click and run.

Though it may seem crude or something. It's easiest to upload the .love and us look through a .love, fix the problem, then repost, rather than explaining it; Just because paragraph explaining is confusing sometimes. But it is explained in the wiki. However, I was never able to learn through reading a wiki myself.
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: "Questions that don't deserve their own thread" thread

Post by Zilarrezko »

ELFUERTE wrote:I cannot stress enough about how great you guys are. Really, I'm learning so much. The second possible solution is what I was using before,but it didnt work as I wanted. I had tought of the first solution,but I didn't know how to actaully implement it and I tought it wasnt optimal. Btw what's the other problem? And thanks a lot again for your time :oops: .
I always say that if you want it to be done, it's always optimal. But not always optimized haha.

The problem was that you were calling Boy.keypressed in both the love.keypressed function in main.lua, and in the TreeLevel.Update function.

So what would happen is when you pressed, let's say "w" on the keyboard. It would queue a keypessed event. Then, depending on where the code is being executed at the time, give whether the boy.keypressed function is called in the keypressed function in main.lua or the boy.keypressed function in update. But it would only call the boy.keypressed function in love.keypressed once, because you only pressed "w" once. Then it would run the boy.keypressed in the update function... every frame... so anywhere from 0 times per second (really bad computer) to over 1000 time per second (most computers now adays, depending on the operations per frame).

So I commented out the boy.keypressed function in the TreeLevel.lua, to prevent confusion. Although, I probably should have gotten rid of it. But that's a stylistic thing and most likely different from person, to person. But to sum up that last paragraph. You were running it every frame, along with in the love.keypressed.

Have fun man, and I'm glad to help.

EDIT: I'm sorry man, I just realized that I just reiterated the whole "per frame" thing, sorry.
Last edited by Zilarrezko on Sun Sep 14, 2014 9:28 am, edited 1 time in total.
User avatar
Ortimh
Citizen
Posts: 90
Joined: Tue Sep 09, 2014 5:07 am
Location: Indonesia

Re: "Questions that don't deserve their own thread" thread

Post by Ortimh »

Zilarrezko, here. The file doesn't open with my installed LÖVE.
Attachments
Source.love
(486 Bytes) Downloaded 166 times
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: "Questions that don't deserve their own thread" thread

Post by Zilarrezko »

Ortimh wrote:Zilarrezko, here. The file doesn't open with my installed LÖVE.
hmm? well, you forgot to end the function love.draw... And with your new amazing 3 lines of code, that was 2. And that's it for me.

This works for me, I can see the text displayed. All I added was the "end" to end the love.draw function
fix.love
(332 Bytes) Downloaded 141 times
If it doesn't show the text for you, than I suggest uninstalling all of löve then reinstalling it.
ELFUERTE
Prole
Posts: 7
Joined: Fri Sep 12, 2014 2:29 pm

Re: "Questions that don't deserve their own thread" thread

Post by ELFUERTE »

Hm,quick question. Since moving the character tile by tile looks a bit choppy,would you suggest moving the character pixel per pixel? Is this a viable alternative?
User avatar
Ortimh
Citizen
Posts: 90
Joined: Tue Sep 09, 2014 5:07 am
Location: Indonesia

Re: "Questions that don't deserve their own thread" thread

Post by Ortimh »

Zilarrezko wrote:hmm? well, you forgot to end the function love.draw... And with your new amazing 3 lines of code, that was 2. And that's it for me.

This works for me, I can see the text displayed. All I added was the "end" to end the love.draw function
The attachment fix.love is no longer available
If it doesn't show the text for you, than I suggest uninstalling all of löve then reinstalling it.
Yeah, with my amazing 3 (2) lines of code. Your fix.love shows text, really. But when I create my own *.love file with your main.lua in it and open it, it won't load. I believe it is because of WinRAR but it archives my file(s) properly and correctly. *.love from others works. Here, my fixed Source.love.
Source.love
(490 Bytes) Downloaded 134 times
ELFUERTE wrote:Hm,quick question. Since moving the character tile by tile looks a bit choppy,would you suggest moving the character pixel per pixel? Is this a viable alternative?
Depends on what you want actually. For 8-bit visuals I prefer for choppy move, but for 16-32-bit visuals I prefer for smooth move.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by bartbes »

Ortimh wrote:I believe it is because of WinRAR
Kind of, but mostly because you tell it to create a rar file, and not a zip file.
User avatar
Ortimh
Citizen
Posts: 90
Joined: Tue Sep 09, 2014 5:07 am
Location: Indonesia

Re: "Questions that don't deserve their own thread" thread

Post by Ortimh »

bartbes wrote:Kind of, but mostly because you tell it to create a rar file, and not a zip file.
Yeah, that fixed my problem. Thanks, bartbes.
Locked

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests