Using dt - [SOLVED]

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.
Post Reply
User avatar
bgordebak
Party member
Posts: 130
Joined: Thu Jul 10, 2014 2:04 am
Location: Ankara, Turkey

Using dt - [SOLVED]

Post by bgordebak » Fri Jul 18, 2014 2:03 am

Using dt makes my game painfully slow. What can be the problem?

Edit: .love file is attached.

Here's the code:

Code: Select all

...
elseif liney == 326 then
	  difficulty = 10
elseif liney == 364 then
	  difficulty = 15
elseif liney == 402 then
	  difficulty = 20
...
function love.update(dt)
if isSplash == false then
    if love.keyboard.isDown("left") then
	velx = -difficulty
	vely = 0
    end
    if love.keyboard.isDown("right") then
	velx = difficulty
	vely = 0
    end
    if love.keyboard.isDown("up") then
	vely = -difficulty
	velx = 0
    end
    if love.keyboard.isDown("down") then
	vely = difficulty
	velx = 0
    end

...

ballx = ballx + (velx * dt)
bally = bally + (vely * dt)
Attachments
one way to go.love
(1.85 MiB) Downloaded 58 times
Last edited by bgordebak on Fri Jul 18, 2014 2:24 am, edited 1 time in total.

davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Using dt

Post by davisdude » Fri Jul 18, 2014 2:17 am

It's just slow compared to what you're used to, not to what it actually should be. Just increase the speed some more and that should do it for you.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim

User avatar
bgordebak
Party member
Posts: 130
Joined: Thu Jul 10, 2014 2:04 am
Location: Ankara, Turkey

Re: Using dt

Post by bgordebak » Fri Jul 18, 2014 2:23 am

Thanks. I just figured it out. I was giving difficulty a default value which was very small.

User avatar
IMP1
Prole
Posts: 39
Joined: Mon Oct 03, 2011 8:46 pm

Re: Using dt - [SOLVED]

Post by IMP1 » Fri Jul 18, 2014 8:45 pm

dt is in seconds, so you need to think about how much things should move (in pixels generally) per second and have that as the speed.

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests