I am trying to code flappy bird but the pipes wont spawn correctly

Viewed 31

I am creating a flappy bird clone The pipes just seem to spawn randomly without any math.random() I don't know what is happening I used If statement to spawn the pipes and not a for loop The pipes seem to be a bit cursed in this case

        pipe1 = Pipe(WINDOW_WIDTH-54, 0,54,topSpace)
        pipe2 = Pipe(WINDOW_HEIGHT-54, topSpace+bottomSpace, 54, WINDOW_WIDTH-bottomSpace-60-15)
    end
        Pipes()
    function SecondPipes()
        pipe3 = Pipe(490, 0,54,topSpace)
        pipe4 = Pipe(490, topSpace+bottomSpace, 54, WINDOW_WIDTH-bottomSpace-60-15)

    end
    SecondPipes()
    end

    function love.update(dt)

        if pipe1.x + pipe1.width and pipe2.x + pipe2.width < 0 then
            pipe1.x  = WINDOW_WIDTH
            pipe2.x  = WINDOW_WIDTH

        end
        if pipe3.x + pipe3.width and pipe3.x + pipe3.width < 0 then
            pipe3.x  = WINDOW_WIDTH
            pipe3.x  = WINDOW_WIDTH

        end

    pipe1:update(dt)
    pipe2:update(dt)
    pipe3:update(dt)
    pipe4:update(dt)


end```
0 Answers
Related