Search found 85 matches
- Tue Jun 13, 2023 3:19 pm
- Forum: General
- Topic: What project (assets) convention do you use?
- Replies: 1
- Views: 1672
What project (assets) convention do you use?
I dunno how to explain that but here are some examples: game = { state = "", layout = "", sprites = { player = love.graphics.newImage("assets/player.png"), tile = love.graphics.newImage("assets/tile.png") } } state = "" assets = { tile = love.graphic...
- Tue Jun 13, 2023 8:22 am
- Forum: General
- Topic: Trying to make collisions work
- Replies: 17
- Views: 4075
- Tue Jun 13, 2023 5:16 am
- Forum: General
- Topic: Trying to make collisions work
- Replies: 17
- Views: 4075
Re: Trying to make collisions work
And here's the library's github repo, but it doesn't have the current changes like in the code I've sent above: https://github.com/notcl4y14/lCollision Thanks, here some fixes: -- lCollision.lua -- https://github.com/notcl4y14/lCollision/blob/main/lCollision.lua local lCollision = {} lCollision.__i...
- Mon Jun 12, 2023 11:26 am
- Forum: General
- Topic: Trying to make collisions work
- Replies: 17
- Views: 4075
Re: Trying to make collisions work
Wouldn't you mind me sharing the code of the library I'm trying to make so you can find out how it works and how to make the separate() function. Sorry for me being like this. You can share your lib and we are trying to fix it. Here dx and dy are just the position difference, we don't change the ve...
- Mon Jun 12, 2023 9:51 am
- Forum: General
- Topic: Trying to make collisions work
- Replies: 17
- Views: 4075
Re: Trying to make collisions work
If nothing moves then nothing collides! But if you move something, then you need to solve this for all colliding objects. The system I'm trying to make is if it collides then it will separate, so it means that if the object will move or instantly teleport into a collider then it will separate. Not ...
- Mon Jun 12, 2023 8:00 am
- Forum: General
- Topic: Trying to make collisions work
- Replies: 17
- Views: 4075
Re: Trying to make collisions work
So it only works via dx and dy? No checking if the collider collides with another one and separate it from that collider just via setting the position but dx and dy? If nothing moves then nothing collides! But if you move something, then you need to solve this for all colliding objects. The system ...
- Sun Jun 11, 2023 8:30 pm
- Forum: General
- Topic: Trying to make collisions work
- Replies: 17
- Views: 4075
Re: Trying to make collisions work
Just https://love2d.org/wiki/love.keyboard.isScancodeDown function love.update (dt) local scancodeW = love.keyboard.isScancodeDown("w") local scancodeS = love.keyboard.isScancodeDown("s") local scancodeD = love.keyboard.isScancodeDown("d") local scancodeA = love.keyboa...
- Sun Jun 11, 2023 7:25 pm
- Forum: General
- Topic: Trying to make collisions work
- Replies: 17
- Views: 4075
Re: Trying to make collisions work
:awesome: Update: Solution: local function checkCollision(x1,y1,w1,h1, x2,y2,w2,h2) return x1 < x2+w2 and x2 < x1+w1 and y1 < y2+h2 and y2 < y1+h1 end local function separateRectangles (agent, box) local x1, y1 = agent.x, agent.y local w1, h1 = agent.w, agent.h local x2, y2 = box.x, box.y local w2,...
- Sun Jun 11, 2023 3:08 pm
- Forum: General
- Topic: Trying to make collisions work
- Replies: 17
- Views: 4075
Re: Trying to make collisions work
Where are you choosing if it horizontal or vertical collision solving? Is it possible that you need vertical and horizontal solving simultaneously? I mean I'm trying to make a function that separates a collider from another one when they collide. But for some reason when the collider collides with ...
- Sun Jun 11, 2023 10:03 am
- Forum: General
- Topic: Trying to make collisions work
- Replies: 17
- Views: 4075
Trying to make collisions work
When the collider collides from the top or the bottom it just goes along the side to either left or right. function lCollision.Collider:separate(collider) while self:collides(collider) do local centerX, centerY = self:getCenter() local rightSide = self.x + self.width local bottomSide = self.y + self...