this day after i fixed the embed tile now i had another problem
and this problem is so strange for me
i couldnt solve it
the first thing that i was watching a vid for how to make a collision for the wall / player i put these codes :
1
2
2
wf = require 'windfield' world = wf.newWorld(0 ,0)
this code for including the windfield folder for the love2d file after it i put this code for making a collider
1
2
2
player.collider = world:newBSGRectangleCollider(400 , 250 , 50 , 100 , 10) player.collider:setFixedRotation(true)
then i put this code i think it is for loading the collision for the walls / player
and this code who gave me an error after i run it but i will give you the other codes to understand the problem well
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
walls = {} if map.layers['walls'] then for i, obj in pairs(map.layers['walls'].objects) do local wall = world:newRectangleCollider(obj.x , obj.y , obj.width , obj.height) wall:setType('static') table.insert(walls , wall) end end end
then i put this code i think it is for setting the simple collision at the position ( 0, 0)
1
2
2
local vx = 0 local vy = 0
then i put to the row of the player movement code these codes :
1
2
3
4
2
3
4
vx = player.speed vx = player.speed * -1 vy = player.speed vy = player.speed * -1
then i put this code for setting a velocity to the player collider
1
player.collider:setLinearVelocity(vx , vy)
then i added this code for updating the world and for setting the position x / position y for the player collider
1
2
3
2
3
world:update(dt) player.x = player.collider:getX() player.y = player.collider:getY()
then i put this code at the end to draw the world
1
world:draw()
and at the end of all of this i got this error and i really dont know what i should modify to make my love2d project work
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
Error windfield/init.lua:745: Box2D assertion failed: area > b2_epsilon Traceback [love "callbacks.lua"]:228: in function 'handler' [C]: in function 'newFixture' windfield/init.lua:745: in function 'newRectangleCollider' main.lua:40: in function 'load' [love "callbacks.lua"]:136: in function <[love "callbacks.lua"]:135> [C]: in function 'xpcall' [C]: in function 'xpcall'
note : this code isnt compeleted it is just for loading the collisons to the wall / player
note : while i was watching the vid i went to tiled and i added an object and i called it walls then i went to ground layer to draw the wall then i went to walls object to select the wall by insert rectangle tool in tiled then after i selected the rectangle wall by insert rectangle tool i exported the file as lua and i already have the code that loads the map then i got the error ^^^^
i hope anyone to solve it