Page 2 of 2

Re: Collision border problem within my game.

Posted: Thu Dec 23, 2021 4:22 pm
by dsk031
pgimeno wrote: Thu Dec 23, 2021 4:10 pm I've found the source here: https://github.com/games50/pong/blob/ma ... n.lua#L105

The function isn't finished at that point; it keeps going. The end of the function is at line 175.
Holy crap, I just fixed it by looking at this code... I removed a function that was not there in the code that you just posted..

This function is not there on this block of code that you provided from Git... Once I removed I fixed the collision problem... You are a lifesaver :) thank you and much appreciated..

Code: Select all

--REMOVED this function-- function love.update(dt)
	-- player 1 movement
	if love.keyboard.isDown('w') then
		-- add negative paddle speed to current Y scaled by deltaTime
		player1.dy = -PADDLE_SPEED
	elseif love.keyboard.isDown('s') then
		-- add positive paddle to current Y scaled by deltaTime
		player1.dy = PADDLE_SPEED
	else
		player1.dy = 0
	end

    -- player 2 movement
	if love.keyboard.isDown('up') then
		-- add negative paddle speed to current Y scaled by deltaTime
		player2.dy = -PADDLE_SPEED
	elseif love.keyboard.isDown('down') then
		-- add positive paddle to current Y scaled by deltaTime
		player2.dy = PADDLE_SPEED
	else
		player2.dy = 0
	end

Re: Collision border problem within my game.

Posted: Thu Dec 23, 2021 4:26 pm
by dsk031
His block of code for movement has that function removed as well, can't believe I missed that... Bug fixing is tons of fun :sarcasm: