Code Monkey home page Code Monkey logo

gd50's People

Contributors

coltonoscopy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gd50's Issues

self.player.dy and self.y depend on FPS (dt)

Example in Bird.lua 23:32

function Bird:update(dt)

    self.dy = self.dy + GRAVITY * dt
    if love.keyboard.wasPressed('space') then
        self.dy = -5
        sounds['jump']:play()
    end

    self.y = self.y + self.dy
end

Each dt self.y increases. Particularly if FPS is 60 then after 2 seconds (120 frames) self.y == (VIRTUAL_HEIGHT / 2 - 8) + 2420. In case of having 144 FPS after 2 seconds (288 frames) self.y == (VIRTUAL_HEIGHT / 2 - 8) + 5780.

I opened a pull request #5 fixing the issue in Bird.lua. Will add another one (if there's none) for the mario project once I finish the module.


FYI, here's the formula of the original self.y: (VIRTUAL_HEIGHT / 2 - 8) + (GRAVITY / FRAME_RATE) * (FRAMES * (FRAMES - 1) / 2). I made it like this: (VIRTUAL_HEIGHT / 2 - 8) + (GRAVITY * 60/ FRAME_RATE^2) * (FRAMES * (FRAMES - 1) / 2). This way self.y should change the same over the same period of time with different frame rates. I also multiplied the "anti-gravity" burst by 60 (the original frame rate). I tested it with different refresh rates (30, 60, 144, 155) and it seems to work the same now.

examples out of date for love2d 11.x

push.lua is out of date so doesn't work with love 11.x

push.lua repo is already updated and works with love2d 11.x so file can simply be replaced
Ulydev/push@db9213b#diff-d95e747898ef40d004fd6dd0ec4a9c84)

if you use love 11.x you also need to change colours and audio.newsource lines
pong/main.lua for example needs these lines:
love.graphics.clear(.15, .17, .2, 1) (second line in function love.draw())
love.graphics.setColor(0, 1, 0, 1) ( love.graphics.setColor(0, 1, 0, 1))

sounds = {
    ['paddle_hit'] = love.audio.newSource('sounds/paddle_hit.wav', 'static'),
    ['score'] = love.audio.newSource('sounds/score.wav', 'static'),
    ['wall_hit'] = love.audio.newSource('sounds/wall_hit.wav', 'static')
}

after that it seems to work again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.