Falling in LÖVE with Lua

  Рет қаралды 73,182

CS50

CS50

Күн бұрын

Пікірлер: 125
@marcellacosta1375
@marcellacosta1375 4 жыл бұрын
I was introduced to Lua back in Rio during my graduation at PUC, by its own creator! Roberto Ierusalimschy. Fantastic language and fantastic teacher
@quentinlucca6271
@quentinlucca6271 3 жыл бұрын
I guess Im randomly asking but does anybody know of a trick to log back into an instagram account? I was stupid forgot my account password. I appreciate any tricks you can offer me
@lufsss_
@lufsss_ 2 жыл бұрын
Quem diria que Lua se tornaria uma linguagem tão conhecida mundo afora!
@requi2383
@requi2383 6 жыл бұрын
I am completely in love with Lua too, I am happy that I am not the only one!
@mansodev
@mansodev 4 жыл бұрын
The community is quite small, but it’s faster and more lightweight than python (but that doesn’t mean python is bad) and is why I chose it.
@ShemarMcLean
@ShemarMcLean 6 жыл бұрын
I'm soo glad there's a talk about this
@shubhammittal9764
@shubhammittal9764 7 жыл бұрын
Does creating games seems more fun than playing it, or I am just going nuts? (which I often do)
@coltonoscopy
@coltonoscopy 7 жыл бұрын
I tend to get a lot of enjoyment out of both :)
@shubhammittal9764
@shubhammittal9764 7 жыл бұрын
Thanks for introducing Lua to us, will explore it after I've completed cs50 :)
@coltonoscopy
@coltonoscopy 7 жыл бұрын
Hope you have fun! :D
@waltermelo1033
@waltermelo1033 6 жыл бұрын
creating a game for me is a game by itself
@harjitsingh7308
@harjitsingh7308 6 жыл бұрын
Colton Ogden hey colton, just have a quick question how would i usee moonscript with löve ? (Btw moonscript is a language that compiles to lua, it takes away the need of most of the syntax for curly braces etc and makes life easier lol)
@vaishnav_mallya
@vaishnav_mallya 6 жыл бұрын
Thank you CS50 and Colton for this amazing course 😁. It's really helpful for beginners like me to get started. I have been trying to get into gamedev for months but stumble, trip and fall because I tried to jump to higher rungs instead of climbing from the bottom. Love2D is awesome way to get started and I've felt it. Completed pong and can't wait to make other games in the course.
@52factorial-prob
@52factorial-prob 6 жыл бұрын
great video for a great project. The guys who maintain LOVE need some LOVE because they rock. Games in 2018 suck major ass unfortunately. So, i challenge people to make games we would rather player using awesome tools like LOVE. Game Dev faces on, go go go.
@gwrydd
@gwrydd Жыл бұрын
3:20 you missed out that the same thing you explained prior (globals vs locals) also applies to functions local function say(...) --local functions print(...) end function say(...) --global function print(...) end
@lua2wood
@lua2wood 4 жыл бұрын
Thank you guys for falling in love with me!!
@victornoagbodji
@victornoagbodji 4 жыл бұрын
🙏 this is a solid introduction. thank you!
@tofu2064
@tofu2064 4 жыл бұрын
omg lua fan base!!!!!!! what???!!!!☺️☺️☺️☺️
@jared_per
@jared_per 4 жыл бұрын
Yeah! Lua absolutely deserves a strong fan base!
@abhishekamoli2911
@abhishekamoli2911 2 жыл бұрын
@@jared_per is there is any future of Lua. I am new i don't know much about programming. Is Lua worth it ?
@jared_per
@jared_per 2 жыл бұрын
@@abhishekamoli2911 I personally think it's worth it. Though it is less popular than a lot of other languages, it is still very useful. Depending on your skill level and need, it can vary how useful it will be for you. But it's used commonly in gameDev, Adobe Photoshop Lightroom uses it. one of my favorite strategy games uses a modified LUA. In terms of popularity, it's (unfortunately) not growing growing much, but it's not dying either. I personally think it should get a lot more attention than it does, but I am biased because it's my first language I learned.
@abhishekamoli2911
@abhishekamoli2911 2 жыл бұрын
@@jared_per thanks for replying sir I have just started programming and i am very confuse which language should I learn first. Thanks for giving me your opinion it means a lot to me.
@jared_per
@jared_per 2 жыл бұрын
@@abhishekamoli2911 I'm very happy that I started with Lua. Getting started with it is much easier than something like C#. You don't have to worry about type setting and such. You just... program.
@FuzzyImages
@FuzzyImages 2 жыл бұрын
OK... why wasn;t this at the start of the CS50G course? It tosses you into pong and I was so confused how things worked in Lua when trying to work on project 0!
@pacrox22
@pacrox22 Жыл бұрын
Great lecture. You should do part II coding the enemies and their AI.
@ThatOneRobloxDev
@ThatOneRobloxDev Жыл бұрын
Lua is also integrated into the Roblox Studio game engine. It is much similar to Love2D but its 3D and integrated as a game engine with pre-made UI
@notiashvili
@notiashvili 6 жыл бұрын
Great stuff. Just wondering why you used string keys in the sounds table instead of just doing: sounds = { jump = love.audio.newSource(a, b), hit = love.audio.newSource(a, b), coin = love.audio.newSource(a, b) } This way seems better since some editors would even auto suggest the sounds whenever we accessed self.sounds. Is there more to it that I'm not seeing?
@coltonoscopy
@coltonoscopy 6 жыл бұрын
thanks Nika!! You could definitely do it that way, but then you're limited to naming your keys with symbol limitations (i.e., no dashes or other characters you couldn't put into a variable name, including spaces). Also, if you want to have maybe 10 sound effects that are similarly named (hit1, hit2, hit3), you could programmatically access them if they were in string format but not so if they were symbols, if that makes sense? For many use cases though, the distinction doesn't necessarily matter; I just default to this method!
@notiashvili
@notiashvili 6 жыл бұрын
Thanks for the reply! I didn't take variable naming restrictions into account, now that you explained it, that seems like an obvious reason why one would use string keys. What I didn't get is the "hit1, hit2, hit3" example where you wrote that one could access them programmatically I can access sounds.jump just as well as sounds["jump"]. The advantage I see of the string key here may be with the ability to to access each sound with a variable. Like: -- Say we have some local variable 'currentSound' somewhere in the scope if player.isRunning then currentSound = "running" -- maybe some more cases here... elseif player.isWalking then currentSound = "walking" end self.sounds[currentSound]:play() Probably not what you meant, but am I close? (You don't have to answer, already thankful for the reply)
@coltonoscopy
@coltonoscopy 6 жыл бұрын
Hey Nika, the programmatic access I'm referring to could vary case by case, but one I just used in the most recent lecture example actually is there are five sounds called 'wood1', 'wood2', 'wood3', etc., and I can randomly choose one of them by simply appending a math.random(5) call to the string 'wood' and then indexing the sounds table with that new generated string, which isn't possible with variables! You could also just lump all of these in a nested table of their own and then simply do a gSounds['wood'][math.random(#gSounds['wood'])], but that starts to obviously get a little bit hairy! Hope that helps!
@notiashvili
@notiashvili 6 жыл бұрын
Thanks! I realize there are many ways to go about solving this certain problem but I wanted to know your reasons for going with the one you use. Also, playing a random sound from a nested sounds table doesn't have to be that messy. You could easily set the __call function of the inner table to play a random sound from its children. Like: ``` sounds = { hit = { love.audio.newSource(a, b), love.audio.newSource(a, b), love.audio.newSource(a, b) } } setmetatable(sounds.hit, { __call = function(self) self[math.random(#self)]:play() end }) -- This metatable can even be abstracted away so you could simply call -- setemtatable(sounds.hit, randomSoundMetaTable) ``` so now instead of sounds.hit[math.random(#sounds.hit)]:play() you would only have to do sounds:hit() or when using string keys, simply sounds["hit"]() -- the self argument is implicit here, I suppose I get that having to set the metatable on every nested sound table would be a pain, but one could just loop through the sounds table once inside love.load() and just setmetatable. Less hair, less string concatenation and more lua magic. I just set up a working example here if you want to check it out: github.com/Nikaoto/sounds-table
@coltonoscopy
@coltonoscopy 6 жыл бұрын
Hey Nika, that's a great approach to the problem! It then lets you also place the :stop() method inside the __call function to clean up examples that call it every time we call play() as well :) While I think this is great for a real-world code base, or a more advanced class, I think it's a little too fancy for this intro class; indeed, we deliberately strayed from using metatables altogether in favor of using HUMP's "Class" library, which we've bundled with every distro, just to make things a little closer to what folks have expected from CS50's use of Python classes (or maybe folks with a Java background or the like). But if I were making a commercial game in Lua, I would definitely use your approach for this use case to clean up the code! Thanks for putting together that demo! :D
@DadoSutter
@DadoSutter 6 жыл бұрын
Great talk, thanks for sharing! Is there a link for the code used on the presentation? Thanks again for this.
@SamVillage
@SamVillage 4 жыл бұрын
0:33 github.com/CS50/Mario-demo
@DASARITUTS
@DASARITUTS 7 жыл бұрын
dear coloton how many inches in size the TV your using in your lecture.
@coltonoscopy
@coltonoscopy 7 жыл бұрын
85"!
@DASARITUTS
@DASARITUTS 7 жыл бұрын
thanks you coloton i am an Asst.professor and I wanted to use a TV for my edu. channel kzbin.info I hope you like my work.
@canilusthesomething7652
@canilusthesomething7652 4 жыл бұрын
oh my god lua is so hot
@yash1152
@yash1152 3 жыл бұрын
17:12 sprite sheet (ahw, nice. so this is what those little image in the games folder are called) 17:13 lua is one indexed
@thecastiel69
@thecastiel69 2 жыл бұрын
I can see 3 persons and a camera on the screen
@yash1152
@yash1152 3 жыл бұрын
1:00:38 "... divided by [INAUDIBLE]" oh lol, it's: "... divided by self dot tile-height"
@not_amanullah
@not_amanullah 8 ай бұрын
Thanks
@liamjonah02
@liamjonah02 4 жыл бұрын
What Text Editor Do You Use With Lua and love?
@Linguaholic
@Linguaholic 4 жыл бұрын
Check out ZeroBrane
@naserdakhel5051
@naserdakhel5051 4 жыл бұрын
In this video he's using VS Code, you need to install a couple plugins to make it work easily.
@naserdakhel5051
@naserdakhel5051 3 жыл бұрын
@BloxyHD Oh, Looking at it again I think you're right!
@lowrhyan567
@lowrhyan567 3 жыл бұрын
Just use neovim noob
@arkahv
@arkahv 2 жыл бұрын
Any, but choose Atom if you want customizablity
@hrnekbezucha
@hrnekbezucha 2 жыл бұрын
Shame the git repo isn't linked in the description
@DavidMadrigalHernandez
@DavidMadrigalHernandez 7 жыл бұрын
Is there a list if packages that he's using for Atom? His setup looks REALLY nice. :)
@coltonoscopy
@coltonoscopy 7 жыл бұрын
No real packages in use here, except maybe syntax highlighting for Lua (don't recall if Atom ships with it)! :)
@zev108
@zev108 2 жыл бұрын
where is the link to the git repo ?
@elrbybark
@elrbybark 7 жыл бұрын
what is the ide he is using..
@coltonoscopy
@coltonoscopy 7 жыл бұрын
What do you mean Atef? :)
@elrbybark
@elrbybark 7 жыл бұрын
I meant the IDE but the auto correction lol..
@coltonoscopy
@coltonoscopy 7 жыл бұрын
oh haha just Terminal + Atom :)
@KanagawaMarcos
@KanagawaMarcos 7 жыл бұрын
By the way, there's a package for Atom which add a lot of tools for LOVE2D game development, such as a simple play button for testing your game.
@3finggaz
@3finggaz 6 жыл бұрын
anybody have this running the github lovedemo ? : Error push.lua:101: attempt to call field 'getPixelScale' (a nil value) Traceback push.lua:101: in function 'initValues' push.lua:48: in function 'setupScreen' main.lua:26: in function 'load' [C]: in function 'xpcall' [C]: in function 'xpcall'
@_mickmccarthy
@_mickmccarthy 6 жыл бұрын
Have you just downloaded Love? If so, you may be running Love v11, which just came out. I can run it fine with 0.10 which was the previous version.
@3finggaz
@3finggaz 6 жыл бұрын
yeah you're right, with the previous version it's work fine. thank you !
@SantiagoGonzalez22
@SantiagoGonzalez22 6 жыл бұрын
Thanks for the video! Can anyone share the link to download the source code please?
@levynkhs8820
@levynkhs8820 5 жыл бұрын
Created one game which is the pong,since that day i never stopped playing because i learned how to code and make this game.im using windows so its a real pain in the ass to configure it and each time you have to go on folder that your main.lua program is and the press shift right click the command promp and press love . In mac you only have to press start i think
@adityamehra7238
@adityamehra7238 4 жыл бұрын
which text editor is being used here?
@onoonoonoO
@onoonoonoO 4 жыл бұрын
@@adityamehra7238 try zerobrane
@aftalavera
@aftalavera 10 ай бұрын
There goes the Harvardhood!
@colab_ora
@colab_ora 23 күн бұрын
wow, such a nice class! someone maybe have the github with the code?, i will thanks a lot 🙏
@PySnek
@PySnek Ай бұрын
Thanks to all the unnecessary OOP, he somehow achieved to make very simple love2d Lua look nearly as complicated as C code.
@PatrickAngel525
@PatrickAngel525 6 жыл бұрын
Love the presentation, and I know the video is very long, but you should've taken your time as you talk very fast
@sciencevidyarthi4061
@sciencevidyarthi4061 3 жыл бұрын
I like LUE
@Foxtro
@Foxtro 3 жыл бұрын
LUE
@Noob-ix1bf
@Noob-ix1bf 2 жыл бұрын
#Lua
@doctorbeans9274
@doctorbeans9274 4 жыл бұрын
Yeah I also want to fall in lion with lua
@duxofducks
@duxofducks 2 жыл бұрын
3:45 Do this body
@Djheffeson
@Djheffeson 4 жыл бұрын
14:02 what? lol
@GhostScoutGS
@GhostScoutGS 5 жыл бұрын
i will try to learn this and make the best roblox game ever
@nevoyu
@nevoyu 4 жыл бұрын
By no means an expert, but he could do better here. 5:06 line 61 rather than having it look like what's shown he can instead do local person = { name = 'Colton Ogden', age = 26, height = 69.5, } this way is a bit more efficient in key strokes and some performance applications since lua will create one table "person" and associate "name", "age", "height" with just that table. Whereas what his example shows are 4 different tables
@TheViktorPutin
@TheViktorPutin 2 жыл бұрын
year old comment, I know, but I believe Colton is doing this to illustrate that you can declare and append variables to a lua table without having to declare your variable with those values initially. it helps to know that you can simply do: person.name = var or person["name"] = var
@moshamiracle
@moshamiracle 5 жыл бұрын
Что он все, когда описывает, с питоном сравнивает.
@hexbit01
@hexbit01 6 жыл бұрын
Sheldon Cooper is you? 😂😂😂😂😂😂😂
@coltonoscopy
@coltonoscopy 6 жыл бұрын
Who told you??? XD
@Matrixprogrammmer
@Matrixprogrammmer 6 жыл бұрын
Colton you're awesome XD
@W_0_W
@W_0_W 6 жыл бұрын
OOP in Lua is very ugly and painful. Use Moonscript if you really need OOP.
@SteveRHanson
@SteveRHanson 5 жыл бұрын
python >>>>>>>>>>> lua
@moshamiracle
@moshamiracle 5 жыл бұрын
lol ))
@mason3872
@mason3872 5 жыл бұрын
C# >>>>>>>>>>> python Even though they are basically the same
@moshamiracle
@moshamiracle 5 жыл бұрын
@@mason3872 lua >>>>>>>>>>> C# inf loop
@boots3372
@boots3372 5 жыл бұрын
Yes. Python is far more fun and easy to work with. It's also dogshit slow compared to LuaJIT. If that matters to you, then it matters a lot. If it doesn't then Python is far superior imo. If Python could come anywhere near LuaJIT I'd be in heaven.
@Cerbyo
@Cerbyo 5 жыл бұрын
this is unacceptable, you are offering advice and a tutorial pretty much here. How are people supposed to make their own decisions on teh content if you don't allow users to comment and share thoughts on it? I get that you could be getting trolled unfairly, but if all videos do this then people will be continuously learning information they think is credible and it turns out being wrong. We can't have that happen! We must have a dialogue open at all times! If your video is purely entertainment, then sure kill the comments and the ratings...people can decide if they like it by watching it. Educational videos must be treated differently though.
@randominternetuser5123
@randominternetuser5123 5 жыл бұрын
Cerbyo but...you can comment on this video...
@WREFMAN
@WREFMAN 2 жыл бұрын
@@randominternetuser5123 lol
@seniorpz1969
@seniorpz1969 2 жыл бұрын
@@randominternetuser5123 🤣
@aftalavera
@aftalavera 10 ай бұрын
This ought to be a joke!
@salsagal
@salsagal 6 жыл бұрын
Arrays start at 0.
@maximbrykov
@maximbrykov 6 жыл бұрын
"However, it is customary in Lua to start arrays with index 1. The Lua libraries adhere to this convention; so, if your arrays also start with 1, you will be able to use their functions directly" www.lua.org/pil/11.1.html
@maoitsme0
@maoitsme0 6 жыл бұрын
not in lua
Falling in LÖVE with Lua
1:23:20
CS50
Рет қаралды 15 М.
«Жат бауыр» телехикаясы І 30 - бөлім | Соңғы бөлім
52:59
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 340 М.
УЛИЧНЫЕ МУЗЫКАНТЫ В СОЧИ 🤘🏻
0:33
РОК ЗАВОД
Рет қаралды 7 МЛН
DConf '22: Lua and Pallene -- Roberto Ierusalimschy
55:10
The D Language Foundation
Рет қаралды 2,2 М.
Simple Code, High Performance
2:50:14
Molly Rocket
Рет қаралды 267 М.
Why Is Lua So Popular?
8:03
Awesome
Рет қаралды 102 М.
The game of the year was written in Lua
5:32
Tom Delalande
Рет қаралды 218 М.
Making a Game in Lua with No Experience
5:52
Goodgis
Рет қаралды 361 М.
Lua in the Defold game engine - Ragnar Svensson, King
33:19
Lua Workshop
Рет қаралды 2,9 М.
2024's Biggest Indie Hit Was Made With... Love!   LÖVE 2D that is.
9:50
«Жат бауыр» телехикаясы І 30 - бөлім | Соңғы бөлім
52:59
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 340 М.