Search found 438 matches

by undef
Thu Jun 05, 2014 12:19 pm
Forum: Support and Development
Topic: optimizing ImageData:mapPixel
Replies: 5
Views: 2622

Re: optimizing ImageData:mapPixel

I'm getting ~66 FPS on my computer (Macbook Pro with an Intel i7 Sandy Bridge CPU.) I changed 'result = 0' to 'local result = 0' in the sphericalWaves function and did the same for v = sphericalWaves(...) in makePicture, and performance increased to ~75 FPS. Ooops ^^', such obvious mistakes. unfort...
by undef
Thu Jun 05, 2014 4:45 am
Forum: Support and Development
Topic: how to run function every halfsecond instead of millisecond?
Replies: 7
Views: 3824

Re: how to run function every halfsecond instead of millisec

Ok, I like in 2048 kind of? https://gabrielecirulli.github.io/2048/ The code you wrote will only move the player while the key is down, you might rather want to use love.keypressed( k ) The way I usually handle this is like this: keys = { escape = love.event.quit, r = love.load, } function love.keyp...
by undef
Thu Jun 05, 2014 3:41 am
Forum: Support and Development
Topic: how to run function every halfsecond instead of millisecond?
Replies: 7
Views: 3824

Re: how to run function every halfsecond instead of millisec

Ah, sorry... I guess I was too superficial^^ The way you do it right now the position is being changed abpruptly, which doesn't seem natural. What you probably want is it to be more like a spaceship flying in space: Unless it hits something or unless you apply force on it, it just keeps flying. Or d...
by undef
Thu Jun 05, 2014 3:23 am
Forum: Support and Development
Topic: draw and redraw?
Replies: 11
Views: 4347

Re: draw and redraw?

Code: Select all

local t
function love.update(dt)
    t = t + dt
end

function love.draw()
    if t<5 then
        love.graphics.draw(image1, x, y)
    elseif t<10 then
        love.graphics.draw(image2, x+image1Width, y)
    end
end
This should do.
by undef
Thu Jun 05, 2014 2:59 am
Forum: Support and Development
Topic: optimizing ImageData:mapPixel
Replies: 5
Views: 2622

Re: optimizing ImageData:mapPixel

Hmm unfortunately 20 fps is still not good enough if I want to make use of these kind of effects in games. I think my lua code should be alright, if anyone sees something that can be optimized, please let me know. I uploaded a .love. Anyways... is there anything else I could do to make this run more...
by undef
Thu Jun 05, 2014 2:37 am
Forum: Support and Development
Topic: how to run function every halfsecond instead of millisecond?
Replies: 7
Views: 3824

Re: how to run function every halfsecond instead of millisec

You could work with acceleration. Always update this: p.y = p.y + speed.y p.x = p.x + speed.x And then apply acceleration to the speed: -- you should set a terminal velocity so your object doesn't keep accelerating if love.keyboard.isDown("down") and speed.y<terminalVelocity then speed.y =...
by undef
Wed Jun 04, 2014 12:33 am
Forum: Support and Development
Topic: optimizing ImageData:mapPixel
Replies: 5
Views: 2622

Re: optimizing ImageData:mapPixel

Wow!
This is just amazing, works like a charm! :)
I went from 3-4 fps to 20+ fps, thank you very much!
by undef
Tue Jun 03, 2014 9:17 pm
Forum: Support and Development
Topic: optimizing ImageData:mapPixel
Replies: 5
Views: 2622

optimizing ImageData:mapPixel

Hi everyone! First of all thank you all very much for creating such a wonderful tool, I've been excessively using it for the last year now. I think one of the beautiful things about this framework is that it simple, leightweight and efficient. I mainly use löve on fairly old hardware - an old netboo...