xXxMoNkEyMaNxXx wrote:Here, I made a pixel effect version completely from scratch:I couldn't bear your insisting to index tables with strings, why not just use Lua? Instead ofsimply doCode: Select all
table["index"]
Code: Select all
table.index
![Very Happy :D](./images/smilies/ms-glad.png)
xXxMoNkEyMaNxXx wrote:Here, I made a pixel effect version completely from scratch:I couldn't bear your insisting to index tables with strings, why not just use Lua? Instead ofsimply doCode: Select all
table["index"]
Code: Select all
table.index
I don't even what is that.T-Bone wrote:row-les
Strange typo. Maybe I'm turning japanese?timmeh42 wrote:I don't even what is that.T-Bone wrote:row-les
Ontopic, this would also increase the speed dramatically - depending on the size of your squares, 2x2 squares would be a 4 times increase - compared to per-pixel.
spynaz wrote:How would I change the color of the light in the pixel effect one?
Code: Select all
canvas:renderTo(function()
love.graphics.setColor(125, 125, 125, 125) -- color of light
...
end)
hey, Ref. Can you explain me how to use dynamic lights from this .love to make it work for each bullet in this bullet lib?Ref wrote:Thanks!
Didn't appreciate the difference!
Docs say:
"os.clock() Return CPU time since Lua started in seconds."
Thought seconds were seconds - that CPU seconds were then same as Universal seconds.
Good catch!
Really appreciate input.
Edit:
Turns out on my computer that the os.clock() and os.time() happen to give the same elapsed time for this demo.
Demo actually is terminated by bee.buzz:isStopped( ) - when music is over.
Code: Select all
function bullets_load()
bulletspeed = 100
bullets = {
x = 0,
y = 0,
dx = 0,
dy = 0,
bullr = 2
}
end
function bullets_update(dt)
for i,v in ipairs(bullets) do
v.x = v.x + (v.dx * dt)
v.y = v.y + (v.dy * dt)
if checkCircularCollision(v.x,v.y,cx1,cy1,2,cr1) then
print("HIT!")
end
end
end
function bullets_draw()
love.graphics.setColor(0,0,0)
if shooting == 1 then
for i,v in ipairs(bullets) do
love.graphics.circle("fill",v.x,v.y,2)
end
end
end
function checkCircularCollision(ax, ay, bx, by, ar, br)
local dx = bx - ax
local dy = by - ay
local dist = math.sqrt(dx * dx + dy * dy)
return dist < ar + br
end
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest