This is such a fantastic series. Concise and to the point videos, very well explained. I'd love to see more (objects, doors to new maps, enemies, combat, animated tiles etc!!). Following your tutorials I've got the beginnings of a game I hope to port over to the Playdate when it arrives.
@Bub.tv218 ай бұрын
Easiest thing to add is animated tiles. You can do this by in your love.update function add "GameMap:update(dt)" gamemap should be replaced with what your level variable is named then in tiled find the animation button and add the animation to your tiled and thats it!
@geoffpaulsen Жыл бұрын
Great Series @Challacade. Around minute 3:20, it might be useful to note that for the Player Colider, one could calculate the width and height, based on the sprite pixels and the scale factor.
@gwrydd Жыл бұрын
very helpful! for others finding this now like i am. in the for loop he uses "pairs" instead use "ipairs" as it is much faster. the same goes for table.insert it is slower than doing walls[#walls+1] = wall when doing anything that can affect yout performance its always best to use tricks to improve performance
@idoblenderstuffs2 жыл бұрын
pleeeease continue this tutorial series
@Benox-Dev28 күн бұрын
THX for the amazing series ! can you add more tutorials for main menu and game over pls
@big_swivel2 жыл бұрын
How would I approach checking if the player collides with a certain collider?
@Kalebjosewitz2 жыл бұрын
Every time I lock my player x/y and my collider x/y they never match up. Idk what I’m doing wrong
@ATS-uy4vl2 жыл бұрын
Do the following, put (x - width / 2) in player's X position, this also equates to Y position
@stinkyseastar3560 Жыл бұрын
@@ATS-uy4vl hey could you explain that in more detail? I don't understand
@ATS-uy4vl Жыл бұрын
@@stinkyseastar3560 From what I remember at the time, I meant that if you subtract the X/Y position from half the width/height, the Collider will snap to the sprite
@blacktainfalcon70972 жыл бұрын
Thanks, could you maybe show how to do turn-based combat?
@shamsparvezarka1860 Жыл бұрын
This video is a lifesaver
@MirralisDias Жыл бұрын
Is it possible to place a collider on the tree's sprite in advance, so that when you place trees in the Tiled editor, they already come with the collider attached?
@RyanSinghI2 жыл бұрын
mostly everything works fine but when I reach a certain point on the map the player collider seems to move ahead of the character '
@koskenkorva1232 жыл бұрын
make sure your world:draw() is in the right place, above cam:detach()
@beegdigit98113 жыл бұрын
6:35 Where the delta time at Great video as always
@Challacade3 жыл бұрын
Good question, the physics engine handles all dt-related calculations, so you don't have to worry about it at all!
@beegdigit98113 жыл бұрын
@@Challacade Looking at the source code it does seem like dt is passed to the world:update and that in turn passes it to all of it's children.
@Challacade3 жыл бұрын
@@beegdigit9811 that's right. So since the world automatically takes care of all calculations, we don't have to worry about it whenever we're dealing with velocity
@pokeman57963 жыл бұрын
Great video🔥thank you for the upload.
@justinrudig6177 Жыл бұрын
thanks now with that I created borders for my map
@andre.gabriel3 жыл бұрын
Great video thanks for sharing your knowledge. 😀
@moonman20513 жыл бұрын
Not considering my lack of understanding about the code, why do we need to assign the player to the collision box and not the opposite?
@hasagine34792 жыл бұрын
player would bypass collision if we did the opposite
@marcuslangebeck38202 жыл бұрын
i have a question.. I will try to tell my script to start my player in another place.. so, i change the player.x and player.y .. but nothing happens.. ? Is that nok the right way?
@jolt_03 Жыл бұрын
How can I add the wall collisons using bump instead? Windfield is very laggy
@comradechonky63282 жыл бұрын
i don't have any problems but if set vx and vy as global variables(in the update function) instead of a local variable, the player keeps moving even after i stop pressing down the arrow keys. Can someone explain why this dosen't work
@BrandonS-lk2qc3 жыл бұрын
Thank you for doing this!
@DiegoTarragonaCovers2 жыл бұрын
hi there, not sure if you could give me a hand with this, i'm trying to make a little roguelike, and using windfield for the collisions following this video i get movement as intended, but i'd want it to move only on 16px for every keypress, there's a way to move the colliders like that i spent the entire day trying with setLinearVelocity, applyForce and applyLinearImpulse
@KasperKenDev2 ай бұрын
This looks simpler than Godot, and I like the fact all your editing is in the text editor. I tried and failed to make godot work well with vim. And this is Lula so I’m intrigued. Do you feel you miss anything over godot?
@adamwhite93302 жыл бұрын
It seems like needing a whole physics engine just to do collision checking is ridiculous overkill. Surely there's a better way? Games have had collision detection for a lot longer than they've had physics.
@itsaducklin4 ай бұрын
you can definitely code your own aabb collision system, that's easy. but then theres making collisions for things that ARENT just rectangles and then you have a problem along with that, your same logic applies to things like: input, audio, or displaying graphics. and also, the whole physics engine isn't really performance intensive. we're in a day and age where games don't have to be that performant, especially 2d ones, as computers have progressed so much.
@unedited122 жыл бұрын
Is it possible you could include a video or addon to a video that shows how to make your character go behind a sprited object when you walk behind it? I want to make it so my players can walk behind the trees and houses in my game that way they are more immersed!
@The_Codemaster144k2 жыл бұрын
draw whatever you want to walk behind, last and remove colliders on it. if that doesnt work then do the reverse
@unedited122 жыл бұрын
@@The_Codemaster144k What if it's also an item that you want to walk in front of later? I'm trying to make trees you can walk around from a over the top perspective
@The_Codemaster144k2 жыл бұрын
@@unedited12 well you can set a Boolean (true or false) value to set the rendering order. Other than that I really don’t know
@Dada-zm2jb9 ай бұрын
Hello! love your videos! I would like to know how to turn this into a sidescroller. So I want to make something like this turned into a platformer with a jumping mechanic. However, when I turn gravity on, the character and the collider fall really slow and just doesn't feel natural. Thank you!!!
@beatrz32 жыл бұрын
hi in around 12:55 i tried to load the code and it says that the line "local wall = world:newRectangleCollider(obj.x, obj.y, obj.width, obj.height)" is wrong how can i fix it?
@Challacade2 жыл бұрын
What does the error actually say? One thing you could try is deleting the Wall object layer in Tiled, and creating it again. Sometimes some wall objects with 0 width and 0 height get added by mistake
@beatrz32 жыл бұрын
@@Challacade ty very much it worked now:)
@gamerule3611 ай бұрын
thanks so much this also fixed my problem @@beatrz3
@MrInfarct2 жыл бұрын
when I do the set linear velocity my character moves by itself
@ATS-uy4vl3 жыл бұрын
AMAZING!!!!
@cryztalized2809 Жыл бұрын
Ik you probs wont answer but im having issues with it sticking up to the left corner of the player, n ive tried a bunch of different things in trying to fix it but i just simply cant find the answer
@Retro1cАй бұрын
i have a problem, for some reason the bsg rectangle positions at the bottom right corner of the player sprite, how do i fix that?
@piago1457 Жыл бұрын
how do I make the player collider for a platformer? EDIT: also my player flips and comes out of the collide? can i also flip the collider along with the player sprite?
@wh1pper457 Жыл бұрын
excellent guide! can I also ask why can't we use a code for the wall to not move like we used for the collider for player example: "wall.collider:setFixedRotation(true)"
@nicholaswatching Жыл бұрын
Since the wall are static and cannot move, the positions of the walls can't move anyway, so it's not needed. For the player, it would rotate from the player movement I would guess.
@dragondg64122 жыл бұрын
I was so close to the end but i had to give up every single sign told me to give up i only had this one and next but it was too much
@pi_dev2 жыл бұрын
how do i draw something on a object layer
@jolt_03 Жыл бұрын
How do you do so your Game doesn't go laggy? I have seen your Game cavern and It uses windfield colliders but It doesn't go laggy but mine does
@eywrsome420 Жыл бұрын
hello I used the code and it didn't work my "local" is not purple as your code its blue. how can i fix my code. If you want I can share the code and error screen pls answer, thanks already
@Chipichipichapachapadubidubid8 ай бұрын
it's okay. newer versions of vscode do that
@limu37492 жыл бұрын
I get an error after I implement this code 12:51 The error is libraries/windfield/Init.lua:745: Box2D assertion failed: area > b2_epsilon If I remove the code, its working well. I don't know what the cause of this error. please help, Thankyou
@growingmindset72 жыл бұрын
if u made a backup at ur game before doing this (i did this bc of this error) just create the 3rd backup and do on ur 2nd backup the tutorial, if it works, drop the main.lua in ur own game
@Niko759992 жыл бұрын
SAME
@Niko759992 жыл бұрын
.
@Niko759992 жыл бұрын
.
@growingmindset72 жыл бұрын
@@Niko75999 y e s
@Vectorez12 жыл бұрын
Can you change the collision color? and if so, how?
@im0genim0gen462 жыл бұрын
hey do this method work for polygon with more than 4 side?
@romannoodles5856 Жыл бұрын
What if you have diagonal wall tiles?
@alivesurvive471 Жыл бұрын
You can create diagonal collisions using polygon. If you just mean the images, you need several image assets to create realistic diagonal walls.
@Robbit_2 жыл бұрын
Would you happen to have a discord? I've followed all the steps but my walls turn completely white when I run the love2d project, if you know how to fix this, I'd love to know!
@Robbit_2 жыл бұрын
@@stevones718 yeah, two of my layers in tiled where the same name, make sure you draw the right layers to the screen
@stinkyseastar3560 Жыл бұрын
same, I have no idea what to do.
@chromeWarriorXIII3 жыл бұрын
Is there a way to modify this to work with polygonal objects in Tiled, like slopes for example? Polygon Colliders require pairs of coordinates for the vertices so I'm not sure how to pass those to Windfield
@therevillsgames3 жыл бұрын
Yep! I do something similar by creating a polygon object: platforms = {} if gameMap.layers["slopes"] then for i, obj in pairs(gameMap.layers["slopes"].objects) do local polygons = {} local polyObj = obj.polyline for vertNum = 1, #polyObj do local vert = polyObj[vertNum] table.insert(polygons, vert.x) table.insert(polygons, vert.y) end local p = self.world:newPolygonCollider(polygons) p:setType('static') p:setCollisionClass("Platform") table.insert(platforms, p) end end
@chromeWarriorXIII3 жыл бұрын
@@therevillsgames Thanks but for some reason I'm getting an error on the line with #polyObj saying that the length is a nil value. Any idea what could be going wrong there?
@therevillsgames3 жыл бұрын
@@chromeWarriorXIII In my example I have the polygons in the "slopes" object layer in Tiled, and in the export lua map it looks like this: { type = "objectgroup", draworder = "topdown", id = 7, name = "slopes", visible = true, opacity = 1, offsetx = 0, offsety = 0, parallaxx = 1, parallaxy = 1, properties = {}, objects = { { id = 123, name = "", type = "", shape = "polyline", x = 224, y = 576, width = 0, height = 0, rotation = 0, visible = true, polyline = { { x = 0, y = 0 }, { x = 128, y = -64 }, { x = 160, y = -64 }, { x = 224, y = -32 }, { x = 288, y = 0 }, { x = 0, y = 0 } }, properties = {} } } }, Check your map lua and the objects has a polyline table.
@chromeWarriorXIII3 жыл бұрын
@@therevillsgames I also had my polygon layer named "slopes" but the shapes in my map lua are labeled as "polygon" not "polyline" and the table is polygon, not polyline
@therevillsgames3 жыл бұрын
@@chromeWarriorXIII Strange, I added polyline only a week ago, but now when I add a new polygon in Tiled it does output the vertices in the polygon object :? Just update the code to read the polygon table :D Edit: @meaningless [C]ode Ahhh - my "polygon" wasnt closed, so Tiled creates "polylines" table instead of "polygons".
@brunogaio62102 жыл бұрын
Why did you put player.collider = world:newBSGRectangleCollider instead o player.collider = world:newRectangleCollider. The first one didn`t work to me.
@nonnullptrhuman5042 жыл бұрын
world:newBSGRectangleCollider is the choice if you want polygon shape collider.
@EMkrazy Жыл бұрын
Ps. Use only rectangle shape when making a collider in Tiled, if you use other shape like triangle, it won't work because in the code it says "newRectangleCollider" This tip is for newbee like me, if you know how to code with different shape of collider plss teach me🥺
@MirralisDias Жыл бұрын
I managed to get it working with Polylines and Polygons by looking at the structure of the testMap.lua file if gameMap.layers["Colliders"] then for i, obj in pairs(gameMap.layers["Colliders"].objects) do if obj["polyline"] then local lines = obj.polyline for j = 1, #lines do local point1 = lines[j] local point2 = lines[j + 1] if point2 then local line = world:newLineCollider(point1.x, point1.y, point2.x, point2.y) line:setType('static') end end elseif obj["polygon"] then local poly = world:newPolygonCollider(flatten(obj.polygon)) poly:setType('static') end end end
@EMkrazy Жыл бұрын
@@MirralisDias thanks bro
@wesleylima5723 Жыл бұрын
Hey man, thank you so much for the video and explanation! I've found your channel and I am liking it fo much Could you help me a little? In my game the getX() and getY() methods return the center of the BSG collider. Do you know why this is happening? I want them to return the top left corner (as I suppose happens to you). Thanks!
@lauralegorreta4334 Жыл бұрын
9:46
@trouble6043 Жыл бұрын
12:34 for me I get this error in the for loop: Error Libraries/windfield/init.lua:745: Box2D assertion failed: area > b2_epsilon Traceback [love "callbacks.lua"]:228: in function 'handler' [C]: in function 'newFixture' Libraries/windfield/init.lua:745: in function 'newRectangleCollider' main.lua:16: in function 'load' [love "callbacks.lua"]:136: in function [C]: in function 'xpcall' [C]: in function 'xpcall' Could Someone please help me!
@Chipichipichapachapadubidubid8 ай бұрын
SAME!!
@tarunthakur60916 ай бұрын
me too
@p.rasmitadora47313 ай бұрын
I get a error at windfield/init.lua:207: attempt to call method getBodies() (a nil value)
@kushalshrivastav54692 жыл бұрын
I get error in code walls = {} if lvl.layers['Platform'] then for obj in pairs(lvl.layers['Platform'].objects) do local wall = wrld:newRectangleCollider(obj.x,obj.y,obj.width,obj.height) wall:setType('static') table.insert(walls,wall) end end that Error main.lua:28: bad argument #1 to 'pairs' (table expected, got nil) Traceback [love "callbacks.lua"]:228: in function 'handler' [C]: in function 'pairs' main.lua:28: in function 'load' [love "callbacks.lua"]:136: in function [C]: in function 'xpcall' [C]: in function 'xpcall'
@alessioturco9532 жыл бұрын
Hi i did every thing and double checked if i misspelled something but i don't know why i says this. Does any one know ho to fix it? Error main.lua:30: bad argument #1 to 'pairs' (table expected, got nil) Traceback [love "callbacks.lua"]:228: in function 'handler' [C]: in function 'pairs' main.lua:30: in function 'load' [love "callbacks.lua"]:136: in function [C]: in function 'xpcall' [C]: in function 'xpcall'
@Challacade2 жыл бұрын
Double check your line 30 in main.lua. It's saying that on line 30, you're attempting to do a pairs iteration on some table, but it's saying the table you passed in doesn't exist. So check the spelling and capitalization of what you put inside of the parentheses, and make sure that a table with that same name exists in your code
@alessioturco9532 жыл бұрын
@@Challacade i've got as the layer name Walls but if i write the gameMap.layer["Walls"] then i would give me that error. here is what i wrote walls = {} if gameMap.layers["Walls"] then for i, obj in pairs(gameMap.layers["Walls"].object) do local wall = world:newRectangleCollider(obj.x, obj.y, obj.width, obj.height) wall:setType('static') table.insert(walls, wall) end end
@Challacade2 жыл бұрын
@@alessioturco953 it should be pairs(gameMap.layers["Walls"].objects) Looks like it was a minor typo, where you have .object rather than .objects
@alessioturco9532 жыл бұрын
@@Challacade sorry to bother again but the objects spelling did solve that error but now i have this one and i don't know what it means Error libraries/windfield/init.lua:745: Box2D assertion failed: area > b2_epsilon Traceback [love "callbacks.lua"]:228: in function 'handler' [C]: in function 'newFixture' libraries/windfield/init.lua:745: in function 'newRectangleCollider' main.lua:31: in function 'load' [love "callbacks.lua"]:136: in function [C]: in function 'xpcall' [C]: in function 'xpcall' again soory for bothering and thank for the help
@Challacade2 жыл бұрын
@@alessioturco953 I think that error normally means there's some wall objects in your Walls object layer that have an area of 0, which is invalid. Try deleting your Walls object layer, and creating it again, placing in only a few walls at a time and testing it out