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
Delta time Y coordinates problem
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- IAsep-TrixI
- Citizen
- Posts: 89
- Joined: Mon Aug 12, 2013 4:22 am
- Location: Philippines,Asia
Re: Delta time Y coordinates problem
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
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
Re: Delta time Y coordinates problem
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
- IAsep-TrixI
- Citizen
- Posts: 89
- Joined: Mon Aug 12, 2013 4:22 am
- Location: Philippines,Asia
Re: Delta time Y coordinates problem
those errors were made while trying to fix the problem ha ha I guess I forgot to set it back to normal
Who is online
Users browsing this forum: No registered users and 6 guests