Delta time Y coordinates problem

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
IAsep-TrixI
Citizen
Posts: 89
Joined: Mon Aug 12, 2013 4:22 am
Location: Philippines,Asia

Delta time Y coordinates problem

Post by IAsep-TrixI »

just about 1 day ago I noticed that my game titania ex-3 had different speeds on different computers and I said "Didnt I add delta time a long time ago?"
and well I fixed the problem but the thing is, I added dt for player.y it went way too fast and didnt go the same speed as the x coordinate.
Can anyone help?
heres the love files
http://www.mediafire.com/?pbbvy4rkp46gbg0
An agent of the free

check out the game I'm doing with Jkash!
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: Delta time Y coordinates problem

Post by Jeeper »

Your problem has nothing to do with DT this time. Your limit for the vertical velocity is based on your X velocity. Hence it never reaches "max" speed.

if love.keyboard.isDown('s') and
player.xvel > -100 then


this should just be changed to

if love.keyboard.isDown('s') and
player.yvel > -100 then
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: Delta time Y coordinates problem

Post by Jeeper »

Update: You also had some other errors, you where using the ">, <" in a wrong way. Compare this code to the one that you have.

Code: Select all

 if love.keyboard.isDown('w') and
   player.yvel > -100 then 
      player.yvel = player.yvel - player.speed * dt
            player.drawable = playerS[player.pnum]
      player.animtimer = player.animtimer + dt
      if player.animtimer > 0.1 then
          player.pnum = player.pnum + 1
          player.animtimer = 0
      end
      if player.pnum > 4 then
          player.pnum = 4
      end
   end
      if love.keyboard.isDown('s') and
   player.yvel < 100 then 
      player.yvel = player.yvel + player.speed * dt
            player.drawable = playerS[player.pnum]
      player.animtimer = player.animtimer + dt
      if player.animtimer > 0.1 then
          player.pnum = player.pnum + 1
          player.animtimer = 0
      end
      if player.pnum > 4 then
          player.pnum = 4
      end
   end
end
User avatar
IAsep-TrixI
Citizen
Posts: 89
Joined: Mon Aug 12, 2013 4:22 am
Location: Philippines,Asia

Re: Delta time Y coordinates problem

Post by IAsep-TrixI »

those errors were made while trying to fix the problem ha ha I guess I forgot to set it back to normal
An agent of the free

check out the game I'm doing with Jkash!
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests