Awesome tutorial! My son and I are following your tutorials to create a game. Thank you Kyle, keep them coming!
@Challacade3 жыл бұрын
That's awesome!!
@MrInfarct2 жыл бұрын
It must be amazing that your father helps you making video games
@giuyo Жыл бұрын
W Father
@nito80664 ай бұрын
how is it going
@willcubemakes4 ай бұрын
How's your game going? :)
@lamialua262 ай бұрын
In case anyone is interested, you can adjust how zoomed in/out the camera is by changing "cam.scale" in love.load() (e.g. cam.scale = cam.scale * 2) Then, in order for the borders to take that into account, you can also divide all the values by "cam.scale" (e.g. if cam.x < w/2/cam.scale then cam.x = w/2/cam.scale end) Not sure if it's the best way to do it but it seems to be working, hope this helps~
@HopelessGamer-rw5dz3 күн бұрын
bro cam:zoom() exists
@ismyname_jep13942 жыл бұрын
Very well explained. I feel like even if I use these in other languages I'd still be able to implement this feature because you taught the structure of the code logic so well.
@casfewXD3 жыл бұрын
For anyone that is having problems with the right and bottom corners. In the video, he uses an upscaled tileset for the map, but if u're using a normal one and upscaling it through the code, u'll have to multiply "mapW" and "mapH" by the same scale of the map that u multiplied it in the code. Hope that this will help someone :)
@ithalogomes66512 жыл бұрын
AKDJAJDJWJFIWJD I LOVE YOU THANK YOU VERY MUCH
@mielland1621 Жыл бұрын
I don't understand, can you please give me an example?
@juror12 Жыл бұрын
Lol, thank you!
@ZigmaVR1236 ай бұрын
THANK YOU SO MUCH! After having to figure out how to resize individual layers (pain) I was so worried I had run into another issue. Your comment literally saved me!
@itsaducklin5 ай бұрын
@@ZigmaVR123 how did you manage that? I've been struggling with it as well
@justinlua48482 жыл бұрын
I've been trying to do a lot of this the hard way without libraries. This series is so very useful! Also if you get any errors with loading the map, try this in Tileset: Edit > Preferences > General > Export Options > Embed tilesets = true
@SandroSashzАй бұрын
Muito obrigado! Seguindo suas instruções consegui tirar a barra preta embaixo da tela.
@Manny732115 ай бұрын
with sti and love, i thought "ok that's a funny coincedence", but HUMP??? NAH YOU GOTTA BE TROLLING
@comfixit2 жыл бұрын
Great tutorial, thanks for taking the time to make it.
@stinkyseastar3560 Жыл бұрын
Thank you so much for these tutorials, I find them very helpful!
@patagain51612 жыл бұрын
merci pour se tuto, simple pratique et très bien expliqué pas à pas
@musilicks18 күн бұрын
4:53 you could also just offset in the camera lookAt call itself: Cam:lookAt(Player.pos.x + Player.size.width / 2, Player.pos.y + Player.size.height / 2)
@berserkenjoyer-vh5yj2 жыл бұрын
hello i am newbie in Love2D and im trying to make camera fallow player as in guide, but when i write cam:attach, colon is no working i getting error how fix this?
@naelpontes84442 жыл бұрын
3:28 if the layers are inside a folder, the drawing process is in any way different?
@zenolth2 жыл бұрын
For the layer drawing i would just loop thru all the layers and draw them, makes it easier to add new ones ig
@andrewmartin2341 Жыл бұрын
I was about to post that I had problem with my code and it wasn't checking the right border. Turns out I had cam.X instead of cam.x :D Great video man, you might consider posting a link to it in your udemy course somewhere, This is the missing camera piece to the videos you have there :)
@Simon-ik1kb Жыл бұрын
super useful video, thank you.
@gwrydd Жыл бұрын
Just found these they’re very helpful. But please be careful you’re creating many globals which eventually is going to cause issues such as overwriting the same variable and performance issues since reading a global is slower than a local
@danielalegriasallo55513 жыл бұрын
Pretty useful tutorial, ty.
@tlc14323 жыл бұрын
Thanks, this was really helpful
@sethluca2 жыл бұрын
The sti thing that we imported last video doesnt work anymore for me when i try doing the layers at: 3:25. Do you know what the problem is?
@iamstill14512 жыл бұрын
Did that work for u ?, I am having the same problem
@blackbart26822 жыл бұрын
@@iamstill1451 ya it did was having same prob imported the same file with another name with lua ext
@lucaslindgren32373 жыл бұрын
This tutorial is great!
@donnab8477 Жыл бұрын
How do you keep the little guy from walking off the edge into infinity? Is that in a later video?
@jdubz63962 жыл бұрын
Hey! So my background is too small and originally I had it so it was scaled up 3x gameMap:draw(0, 0, 3) But when it draws individual layers it wouldn’t let me scale it. Do you know how to do this?
@ooooggll2 жыл бұрын
I have the same problem Edit: I figured it out, for anyone else who has the problem as well. First I get the camera x and y coordinates with this line: local camx, camy = cam:position() then instead of gameMap:draw(0, 0, 3, 3) I do gameMap:draw(-camx/3, -camy/3, 3, 3) Basically just draw the map at the camera's position Edit 2: turns out this has some problems with stopping the camera at the border of the screen, and likely more problems later on. Also you can ignore the whole local camx, camy line, then replace camx with cam.x and camy with cam.y.
@berserkenjoyer-vh5yj2 жыл бұрын
@@ooooggll oh also do you know how to fix colon error in lua? when i writed exactly - cam:attach i had error by colon, but i dont understand why does it shows up please explain me if you can!
@darkfrei23 жыл бұрын
Can you explain how to make the same result, but without lib/camera?
@Challacade3 жыл бұрын
This is how I recommend doing cameras, so I don't plan on making any other videos about it. I highly suggest sticking with the library, or looking through the camera.lua file to see how it works behind the scenes
@mrxoxtrew6 ай бұрын
after doing this i realized i still have the black background and my character is on it, can you help?
@Its_ME_Nightmare2 жыл бұрын
I'm making a core game in love2D and need a way to make buttons that work and are on a control room area where you can press buttons on the panel this would be a huge help!
@cbaptou Жыл бұрын
How do i scale individual tile layers ?
@DarkkneZPanda2 жыл бұрын
Was wondering if there was any type of zoom in function within the camera or love2d? My tiles are much smaller than 64 x 64 making my map bigger and tiles smaller. If anyone figures this out please let me know
@goladahagua2732 жыл бұрын
very good tutorial! but I wanted to know if there is a way to make the camera similar to the celeste camera. Would you help me with this?
@idoblenderstuffs2 жыл бұрын
werent getWidth and getHeight removed from love though?
@MaverickMeier Жыл бұрын
nooooo thats very important. why would they remove it?
@zurich_playzbg6165 Жыл бұрын
help "Error scripts/sti/init.lua:926: attempt to index local 'layer' (a nil value) Traceback [love "callbacks.lua"]:228: in function 'handler' scripts/sti/init.lua:926: in function 'drawLayer' main.lua:65: in function 'draw' [love "callbacks.lua"]:168: in function [C]: in function 'xpcall' "
@muadtheljayash7733 Жыл бұрын
I'm getting the same thing, helpp
@arunolanchery89996 күн бұрын
Please help
@wegwegedgweg58922 жыл бұрын
I'm sorry, I was really stupid I'm really sorry, the video was great
@narikiskiran6 ай бұрын
I am having troubles, it says that the module camera.lua is not found. Any suggesting?
@itsaducklin5 ай бұрын
NOT camera.lua, just camera in require "camera.lua" it takes periods and uses them as like a forward slash / so, if you put camera.lua, it takes that as camera/lua, which doesn't exist. tldr; replace require "camera.lua" with require "camera"
@narikiskiran5 ай бұрын
@@itsaducklin thank you!
@itsaducklin5 ай бұрын
@@narikiskiran yw :>
@jubayarrahman21 Жыл бұрын
i can't fegure out what's going but my cod dosen't work
@eon14113 жыл бұрын
can you make a video on collisions? it would be a lot of help considering im trying to make a game that heavily relies on collision events AKA, making a video about making something happen when touching something else.
@Challacade3 жыл бұрын
Next tutorial is about adding collisions where the world is solid and the player stops - I'll work on adding in collision events as well!
@microistakeneverywhere3 жыл бұрын
what about normal background? can i have the script for that?
@manikandanu23172 жыл бұрын
Super... Thanks
@MaverickMeier Жыл бұрын
these really ugly lines appear quite frequently. is there a way to get rid of them?
@ndscartridgesАй бұрын
When I add cam.lookAt(player.x, player.y) the following error occurs (please note, i have followed the tutorial to the letter, even drawing layers instead of the map.) Error PGR/lib/camera.lua:72: attempt to index local 'self' (a number value) Traceback [love "callbacks.lua"]:228: in function 'handler' PGR/lib/camera.lua:72: in function 'lookAt' main.lua:66: in function 'update' [love "callbacks.lua"]:162: in function [C]: in function 'xpcall'
@ejsuperstar Жыл бұрын
I've been struggling for a few days now to get this right. My map is very small (20 by 20) and used small tiles (16 by 16) and just *cannot* seem to get the camera to stop at the right and bottom edges. I'm zooming in the camera using the camera zoom built into the camera. It works when I dont zoom in, but the moment I do everything goes wrong, I feel like i've tried everything I can. i know im over a year late to the party but I really need help and I dont know where else to look Edit: Less than 10 minutes after posting I figured out how to fix it. if cam.x > (mapW - w/2/camZoom) cam.x = (mapW - w/2/camZoom) end it was that easy, thats like, basically what I did for the top left, i cant believe it took me so long to figure out ... Either way uh, leaving this here incase anyone needs help too
@corentindeparscau50246 ай бұрын
Thank you so much !
@colwarsstudiobrickfilmandm85802 жыл бұрын
Would this work with an image instead of a tmx file?
@Challacade2 жыл бұрын
If you're using an image for the background rather than a tile map, it should still work. You'd just need to use the image width/height rather than the map's width/height.
@crimson31972 жыл бұрын
what about people who use background as a map
@piquirng2 жыл бұрын
I have a problem. Player is not visible when i start the game
@anonymouslyanonymous0911 ай бұрын
Make sure that you are drawing the after the floor, but before anything you want to show infront of the player
@Ellohir3 жыл бұрын
Cool! Wouldn't it be easier to center the camera by changing the lookAt to player.x+player.width/2 and player.y+player.height/2 ? I feel like drawing the sprite at the center could complicate a lot the collision detection later 🤔 Anyway, great tutorial as always, bounding the camera makes it look very professional 👍🏻
@Challacade3 жыл бұрын
You are right about that other option, but I actually updated the draw offset in preparation for making collisions easier. The physics library we'll be using has the center set to the middle of the collider, so now it'll line up to be the same as the draw. And personally I like having the position match the center, it's easier for me to visualize
@Ellohir3 жыл бұрын
@@Challacade awesome, thanks for your answer!
@MrInfarct2 жыл бұрын
You're the best
@farjoos2 жыл бұрын
3:36
@PerlVeemo2 жыл бұрын
Hump? 🤨
@thcdenton2 жыл бұрын
Love
@growingmindset72 жыл бұрын
this tutorial didnt worked... i am getting errors after errors and i did step by step like in the tutorial...
@MaverickMeier Жыл бұрын
colon not dot. pay very close attention to every line
@domivincze65252 жыл бұрын
Hey! I have a problem that I cant figure out. the error says this: Error libraries/sti/init.lua:854: attempt to index local 'layer' (a nil value) Traceback [love "callbacks.lua"]:228: in function 'handler' libraries/sti/init.lua:854: in function 'drawLayer' main.lua:96: in function 'draw' [love "callbacks.lua"]:168: in function [C]: in function 'xpcall' I dont know what to do, please help Kyle!
@MaverickMeier Жыл бұрын
umm I get an error when camera.lua tries to use self for lookAt
@MaverickMeier Жыл бұрын
nvm just make sure you use the colon and not the dot
@vircobb40772 жыл бұрын
i kepp getting this error Error libraries/camera.lua:115: Maximum stack depth reached (more pushes than pops?) Traceback [love "callbacks.lua"]:228: in function 'handler' [C]: in function 'push' libraries/camera.lua:115: in function 'attach' main.lua:45: in function 'draw' [love "callbacks.lua"]:168: in function [C]: in function 'xpcall'
@vircobb40772 жыл бұрын
never mind im just stupid
@povilasbuda64908 ай бұрын
cam:lookAt(player.x, player.y) doesn't work for me, the player doesn't move when I press the movement keys Edit: I skipped the animation tutorial because I want to focus on that later
@povilasbuda64907 ай бұрын
@@TheNew54321 Thanks!
@wegwegedgweg58922 жыл бұрын
it gives me this error message Error libraries/camera.lua:109: attempt to index local 'self' (a nil value) Traceback [love "callbacks.lua"]:228: in function 'handler' libraries/camera.lua:109: in function 'attach' main.lua:69: in function 'draw' [love "callbacks.lua"]:168: in function [C]: in function 'xpcall' can someone help :(
@mingtongzhi2 жыл бұрын
Make sure you have a : instead of a . on any function that needs to have a colon. I get this error a lot when I make this mistake and it's easy to overlook
@roujiteku211410 ай бұрын
just another guy with the same code error as the others. still no luck Error libraries/sti/init.lua:926: attempt to index local 'layer' (a nil value) Traceback [love "callbacks.lua"]:228: in function 'handler' libraries/sti/init.lua:926: in function 'drawLayer' main.lua:69: in function 'draw' [love "callbacks.lua"]:168: in function [C]: in function 'xpcall'
@roujiteku211410 ай бұрын
okay i fixed it, i apparently renamed one of my layers in Tiled, which i did save but i apparently didn't exporting the new save. that worked, im stupid