Pong Game

Show off your games, demos and other (playable) creations.
clepto
Prole
Posts: 35
Joined: Wed Jul 25, 2012 10:20 pm

Re: Pong Game

Post by clepto » Tue Nov 13, 2012 3:35 pm

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)...

User avatar
Larsii30
Party member
Posts: 267
Joined: Sun Sep 11, 2011 9:36 am
Location: Germany

Re: Pong Game

Post by Larsii30 » Tue Nov 13, 2012 3:56 pm

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.

User avatar
Puzzlem00n
Party member
Posts: 171
Joined: Fri Apr 06, 2012 8:49 pm
Contact:

Re: Pong Game

Post by Puzzlem00n » Tue Nov 13, 2012 8:38 pm

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 :)
I LÖVE, therefore I am.

clepto
Prole
Posts: 35
Joined: Wed Jul 25, 2012 10:20 pm

Re: Pong Game

Post by clepto » Wed Nov 14, 2012 3:48 pm

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

User avatar
mickeyjm
Party member
Posts: 237
Joined: Thu Dec 29, 2011 11:41 am

Re: Pong Game

Post by mickeyjm » Wed Nov 14, 2012 8:07 pm

Slow that ball down!!!

Seriously in the time it took to bring the game into focus (<1 second) the CPU had scored 45 points
Your screen is very zoomed in...

User avatar
Puzzlem00n
Party member
Posts: 171
Joined: Fri Apr 06, 2012 8:49 pm
Contact:

Re: Pong Game

Post by Puzzlem00n » Wed Nov 14, 2012 9:02 pm

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:
I LÖVE, therefore I am.

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests