Search found 612 matches

by ReFreezed
Sun Oct 02, 2022 11:09 pm
Forum: Support and Development
Topic: Drawing outside of love.draw
Replies: 15
Views: 4198

Re: Drawing outside of love.draw

What I'm presenting is several nested loops that make a draw call, what or where isn't important. What I think is happening, and your response seems to confirm, is that the draw call doesn't alter the canvas at all - but instead queues the call, this queue must use memory, and so calling circle() m...
by ReFreezed
Sun Oct 02, 2022 8:08 pm
Forum: Support and Development
Topic: Drawing outside of love.draw
Replies: 15
Views: 4198

Re: Drawing outside of love.draw

It's a bit unclear what the actual problem is as the code doesn't make much sense (the same points are being drawn as circles on top of each other several times, before the result is "presented" to the screen), but here's some possibly relevant information. You mentioned draw calls and buf...
by ReFreezed
Sun Oct 02, 2022 5:03 pm
Forum: Support and Development
Topic: Help with tiles and sprites
Replies: 9
Views: 2390

Re: Help with tiles and sprites

It doesn't seem to be documented anywhere as far as I've seen, for some reason. I feel like LuaJIT's documentation is lacking in general. :/
by ReFreezed
Sun Oct 02, 2022 5:03 am
Forum: Support and Development
Topic: Help with tiles and sprites
Replies: 9
Views: 2390

Re: Help with tiles and sprites

pgimeno wrote: Sat Oct 01, 2022 9:37 pm I used hex because there are no binary literals
Actually, in LuaJIT there are, in the form of 0b11001.
by ReFreezed
Thu Sep 29, 2022 4:56 pm
Forum: General
Topic: A way to do simple shadows
Replies: 25
Views: 9732

Re: A way to do simple shadows

Can you please explain how the first version works? It looks simple, but I cannot get it. Sure. The important parts are the drawEntity() function and how we calculate shearing and y-scaling. local function drawEntity(e, shearingX, scaleY) local scaleX = e.flip and -1 or 1 -- We just use x-scaling t...
by ReFreezed
Thu Sep 29, 2022 4:01 pm
Forum: Support and Development
Topic: Loop Through Bodies and Only Destroy One Body
Replies: 9
Views: 2629

Re: Loop Through Bodies and Only Destroy One Body

The related function is World:setCallbacks . The 'enemy' table is not related to Box2D and so isn't part of the internal hierarchy of objects (not that there is much of a hierarchy), but instead of doing enemy.fixture: setUserData ("Enemy") you could do enemy.fixture:setUserData(enemy) and...
by ReFreezed
Wed Sep 28, 2022 9:57 pm
Forum: Support and Development
Topic: Loop Through Bodies and Only Destroy One Body
Replies: 9
Views: 2629

Re: Loop Through Bodies and Only Destroy One Body

ddabrahim wrote: Wed Sep 28, 2022 9:30 pm The physics engine has built-in collision detection and you did not actually checked if enemy is touching the player (...)
beginContact() is a callback called by the physics engine when there is a collision. There's no need to verify the collision.
by ReFreezed
Wed Sep 28, 2022 9:05 pm
Forum: Support and Development
Topic: Loop Through Bodies and Only Destroy One Body
Replies: 9
Views: 2629

Re: Loop Through Bodies and Only Destroy One Body

The 'a' and 'b' arguments are the fixtures involved in the collision, and you store the enemy fixtures in enemy.fixture, so simply replace the a:getUserData()=="Enemy" checks with a==enemy.fixture, and the same with 'b'.
by ReFreezed
Wed Sep 28, 2022 6:25 pm
Forum: Support and Development
Topic: Loop Through Bodies and Only Destroy One Body
Replies: 9
Views: 2629

Re: Loop Through Bodies and Only Destroy One Body

When you loop through 'allEnemies' in beginContact() you never check if 'a' or 'b' is related to 'enemy' before you start doing stuff to it and the player.
by ReFreezed
Wed Sep 28, 2022 3:22 pm
Forum: Support and Development
Topic: Pressing two buttons at once
Replies: 3
Views: 2239

Re: Pressing two buttons at once

You can return a value from the :mousepressed() functions to signal whether the mouse event was handled or not. function scenetwo:mousepressed(x, y, b) if b == 1 and scenes.scenetwo == true then if (x > button.x and x < button.x + button.w) and (y > button.y and y < button.y + button.h) then print(&...