Page 2 of 2

Re: Pong Game

Posted: Tue Nov 13, 2012 3:35 pm
by clepto
Puzzlem00n wrote:You're not using dt, huh? You have no idea how fast that makes the games run on my machine. You really need to factor this in, it's basic LÖVE, although I can see why you'd think it's safe to ignore. :|
What do you mean? Where to use dt?
i have update (dt)...

Re: Pong Game

Posted: Tue Nov 13, 2012 3:56 pm
by Larsii30
clepto wrote: What do you mean? Where to use dt?
i have update (dt)...
the dt in update( dt ) only says the update loop " hey man, you need dt in your loop !! ".
use dt with values you increase / decrease in your love.update. i.e for the player movement:

Code: Select all


function love.load()

	player.x, player.y = 0, 0
	player.xvel = 200
	
end

function love.update( dt )
	
	if love.keyboard.isDown( "right" ) then
		player.x = player.x + player.xvel * dt	-- xvel is the speed on the x axis
	end

end

This let your game run with the same speed on every computer.

Re: Pong Game

Posted: Tue Nov 13, 2012 8:38 pm
by Puzzlem00n
Have you read the wiki, or did you just skip ahead thinking you knew programming already? (Seems like you must have used some other language in the past, unless you copied and pasted all that code.) Well, love2d is different. I'm trying not to be to mean, but we really shouldn't have to be telling you this, it's fundamental. You should read a tutorial, literally any tutorial, before going forward. Try this: https://love2d.org/wiki/Tutorial:Gridlocked_Player :)

Re: Pong Game

Posted: Wed Nov 14, 2012 3:48 pm
by clepto
I used love in the past...and yes i used other languages and the code is mine...
I just didn't remember some things...
I'll change it later

Re: Pong Game

Posted: Wed Nov 14, 2012 8:07 pm
by mickeyjm
Slow that ball down!!!

Seriously in the time it took to bring the game into focus (<1 second) the CPU had scored 45 points

Re: Pong Game

Posted: Wed Nov 14, 2012 9:02 pm
by Puzzlem00n
mickeyjm wrote:Slow that ball down!!!

Seriously in the time it took to bring the game into focus (<1 second) the CPU had scored 45 points
Yep, that's the dt thing.
On the bright side, the game as it stands is a nice way to brag about your computer's speed.

"Dude, on MY computer, the computer got 100 points in one second!"
"Yo, shut up, bra, hawha!"
:ultraglee: