Very slow character

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Pospos
Citizen
Posts: 73
Joined: Sun Jun 18, 2017 11:10 am
Location: Agadir

Very slow character

Post by Pospos »

Since my lua programs doesn't work on windows, i'm temprorarely tring on linux!
i made a little game where you have to escape an enemy, i'm trying to add bullets but sadly,
my game started to glitched out when i started to split the files in differents .lua files to organize a little bit
the game.
the glitch is that the player character is very slow and i don't know why beacause the enemy is as fast at it was
before i splited the file
(EDIT) the scancode don't work either.
there is the game file.

(EDIT) changed the game file.
Attachments
contents.love.zip
(25.91 KiB) Downloaded 167 times
Last edited by Pospos on Tue Jun 20, 2017 12:56 pm, edited 1 time in total.
User avatar
xNick1
Party member
Posts: 267
Joined: Wed Jun 15, 2016 8:27 am
Location: Rome, Italy

Re: Very slow character

Post by xNick1 »

Would you be so kind to attach a .love file?
User avatar
Pospos
Citizen
Posts: 73
Joined: Sun Jun 18, 2017 11:10 am
Location: Agadir

Re: Very slow character

Post by Pospos »

Done. The file is now a .love file runnable on windows.
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Very slow character

Post by zorg »

Not according to the link in your first post it isn't. (You just renamed the folder to contents.love)

You'd need to put the contents in the folder into a new archive file (a zip file, to be precise), save that, and share that... though google drive auto-zips folders when you download them, so :3

Also, to attach the .love to your post, just drag it into the text area when you're writing a new one, and it'll be attached; Nick meant that, and it's better that way since it won't rely on 3rd party hosts (not that google drive will disappear soon, but still)

Edit: I looked at the project; i have no idea why you have an extra main.lua in your lib folder, but the issue is most probably that you forgot to multiply each something = something + speed with dt.

Code: Select all

x = x + v * dt
That would make movement speeds and everything consistent everywhere.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Pospos
Citizen
Posts: 73
Joined: Sun Jun 18, 2017 11:10 am
Location: Agadir

Re: Very slow character

Post by Pospos »

i have changed these

Code: Select all

       player.x = player.x -player.speed
into these

Code: Select all

    player.x = player.x - player.speed * dt
but now my character doesn't even move.
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Very slow character

Post by zorg »

That's because, as you said, your character moved very slow to begin with.

if the player.speed is 100, then 100*dt means move 100 pixels per second; you have the speed variable set to 2, and 2 pixels/second is slow.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Pospos
Citizen
Posts: 73
Joined: Sun Jun 18, 2017 11:10 am
Location: Agadir

Re: Very slow character

Post by Pospos »

i set the player.speed to 100 but that's still very laggy though.
The character looks disgustingly laggy, it looks like it 3 fps.
Do you have another solution? :roll:
is it possible to set a smaller delta time to, like, 0.01 sec, this way, the character will still look decent.?
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Very slow character

Post by zorg »

dt should be around 1/60 if vsync is on, and 1/1000 if it's off... i haven't looked too much into your code though.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Pospos
Citizen
Posts: 73
Joined: Sun Jun 18, 2017 11:10 am
Location: Agadir

Re: Very slow character

Post by Pospos »

Are you sure this is the only way to lower dt?
Beacause this bool set to true or false it's the same thing.
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Very slow character

Post by zorg »

Yes, that one.
Also it's -not- the same thing.
If it is, then either your drivers are messing something up, or your code is wrong... sadly i dont have more time looking into it, maybe someone else will.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot] and 54 guests