Make games using Odin + Raylib #2: Move, jump & fall ✨ For beginners

Ойындар

Blog post version of this video: zylinski.se/posts/gamedev-for...
This is a beginner friendly intro to making games using the Odin programming language and Raylib. It's meant for people without programming experience, but it might also be interesting to people who know programming, but are unfamiliar with making games.
Throughout this series we will make a small 2D game with simple platforming mechanics.
Contents:
00:00 Intro, recap and what we'll do today
01:03 Add a player character
05:29 Make player character moveable
11:29 Make it possible to jump & fall
19:42 Disallow jumping while in air
22:51 The end!
NOTE: I had to re-upload this video due to a major editing mistake. There was an entire section missing in the original video, which made it confusing to watch.
Odinlang website: odin-lang.org/
Raylib website: www.raylib.com/
Buy my game CAT & ONION on itch.io zylinski.itch.io/cat-and-onion or wishlist on Steam store.steampowered.com/app/27... -- The itch version comes with the full Odin + Raylib source.
You can find me on:
Twitter: / karl_zylinski
Threads: www.threads.net/@karl_zylinski
My Gamdev Discord server: / discord (also has a channel for talking about Odinlang)

Пікірлер: 20

  • @karl_zylinski
    @karl_zylinski5 ай бұрын

    Contents: 00:00 Intro, recap and what we'll do today 01:03 Add a player character 05:29 Make player character moveable 11:29 Make it possible to jump & fall 19:42 Disallow jumping while in air 22:51 The end!

  • @RodrigoSilva-mh4dk
    @RodrigoSilva-mh4dkАй бұрын

    Dude, what you do in this video is pure honor, thank you for these teachings

  • @enricotrudu6760
    @enricotrudu67605 ай бұрын

    It's so refreshing seeing contents like this, when the pace of whats happening on the video has so respect with the needs of who's learning. I'm also think that kids maybe, nowadays, can find so high quality, low-levelish, polite content to start hacking. In this perspective, too, your videos are a great contribution to the handmade culture, now and for the future. It's just what I see. The audio is going better, thanks for that! Keep up the good work!

  • @karl_zylinski

    @karl_zylinski

    5 ай бұрын

    Thank you! I really try to make it it understandable for beginners. Great that you found the sound better! ✨

  • @karl_zylinski
    @karl_zylinski5 ай бұрын

    Hello to anyone who watched this before: I had to re-upload this video due to a major editing mistake (there was like 1.5 minutes missing at 11:29 in the first version)

  • @VimOneLove

    @VimOneLove

    5 ай бұрын

    Hello

  • @glennwiz

    @glennwiz

    5 ай бұрын

    wubwub@@VimOneLove

  • @RishavSharan
    @RishavSharan5 ай бұрын

    Thank you for this series Karl. I had a few requests for deep dive topics (some of these are a bit advanced); 1. Memory Management 2. How do we handle the need for algorithms like astar, perlin, voronoi etc given that odin doesn't have a package manager? 3. wiring up hot reload 4. Embedding and protecting assets. I saw in a previous video, you used Odin's embedding capability. ho about using rres? 5. common Game patterns that you use and why 6. Adding steam api & achievements I know you have discussed some of these in other videos, but I would love it if you would touch upon these as this series is something we can code along with. in your other videos, as I am often looking into your fully formed code, it can get a bit intimidating.

  • @karl_zylinski

    @karl_zylinski

    5 ай бұрын

    Hi, thanks for watching! 1. I will cover in the series later, including using tracking allocator for finding leaks. 2. I probably won't cover this. But what I would say is, if someone posts some A star code online, then you can just copy it to a file in your project and use the code. No need for a package manager. 3. I might not cover this in this series, but I will make an updated video, the old one is a bit crusty. 4. Ray told me about rres, it looks interesting. However, with Odin's #load it wasn't a lot of work to make myself I think. 5. This is a bit vague. My main pattern is just write the first code that comes to mind when you need to get something done, and then change the code if it causes trouble. But I will show some specific things in this series such as sprite animation, some simple collision detection and how to use Raylib cameras. 6. Not sure if I'm gonna make a video on this. But just FYI there are bindings to Steamworks here github.com/jakubtomsu/odin-steamworks if you want to check it out yourself Thanks for your good ideas and questions! Have a nice day

  • @steven-t-e-shaw
    @steven-t-e-shaw2 ай бұрын

    Thanks for making this series. I'm really enjoying it! I'm an experienced coder, but I haven't experimented with gamedev for many years.

  • @vadymbarabanov156
    @vadymbarabanov1565 ай бұрын

    Good job! Very nice video! I was working on a ping pong game using ziglang and raylib so it's cool to see someone is building a project with similar stack so I can learn something new! Also, what's the reason to choose Odin as a programming language? UPD: never mid, I saw you made a ton of videos including one about reasons why Odin is good for game dev. I'm going to watch it now =)

  • @karl_zylinski

    @karl_zylinski

    5 ай бұрын

    Thank you! Good luck with your game ✨

  • @enricotrudu6760

    @enricotrudu6760

    5 ай бұрын

    If your game will give at least a quarter of the fun that I had playing SNES Supertennis, I'll buy it. I promise.

  • @MyriadColorsCM
    @MyriadColorsCM3 ай бұрын

    Question: When passing a variable as aprameter to a rpocedure, by default is it passing by reference (memory) or by value (copy)? I know Odin has pointers, but im nto sure what the default behavior actually is. Edit: Answer in reponse.

  • @MyriadColorsCM

    @MyriadColorsCM

    3 ай бұрын

    I figured it out: its just like C, but now I have to use ^instead of & (because of pascal, lmao). I wrote an inputhandler function like this: InputHandler(&playerPos, &playerVel); InputHandler :: proc(playerPos: ^rl.Vector2, playerVel: ^rl.Vector2) { if (rl.IsKeyDown(rl.KeyboardKey.LEFT)) { playerVel.x = -400; } else if (rl.IsKeyDown(rl.KeyboardKey.RIGHT)) { playerVel.x = 400; } else { playerVel.x = 0; } playerPos.x += playerVel.x * rl.GetFrameTime(); } Because I thought it was ugly to put the whole logic inside of the main loop block directly.

  • @karl_zylinski

    @karl_zylinski

    3 ай бұрын

    Yes, if you want to change parameter pass as pointer. C uses *, not &. The & in C is for taking adress of a value, just like you did in Odin. But also: if you pass by value then it will either be passed as immutable value or as immutable reference, as an optimization. Thus, in order to avoid lots of copying of stack values, you do not have to write "const Type&" like in C++ to pass as immutable reference.

  • @MyriadColorsCM

    @MyriadColorsCM

    3 ай бұрын

    @@karl_zylinskiAnother question: I got the gravity to work jsut as you wrote, but for some reason the jumping doesnt work. I have it setup like this: playerVel.y += 2000 * rl.GetFrameTime(); if (rl.IsKeyPressed(rl.KeyboardKey.UP)) { playerVel.y -= 600; } playerPos.x += playerVel.x * rl.GetFrameTime(); playerPos.y += playerVel.y * rl.GetFrameTime(); if (playerPos.y > f32(rl.GetScreenHeight() - 64)) { playerPos.y = f32(rl.GetScreenHeight() - 64); } Obs: playerPos += playerVel *GetFrameTime(); Also did not work, gave error: Mismatched types in binary expression 'playerVel * rl.GetFrameTime()' : '^[2]f32' vs 'f32' Any idea why?

  • @MyriadColorsCM

    @MyriadColorsCM

    3 ай бұрын

    @@karl_zylinskiI was having trouble implementing the grounded/ungrounded jump mechanic, at first I tried passing the playerGrounded variables by reference, bI supposed it would work because I could also alter the playerPOs and playerel variable by ref and I could mutate them as a side effect fo the function, but when I tried doing: playerGrounded = false; It said there was a "mismatch" of types between the pointer of the boolean and the new value. DOnt knwo what that's about. So what I did was declaring a local static variable inside of the funtion: @(static) playerGrounded: bool = true; It had to be static since every time the function was called, the value was reset to "true" and the air jumping still worked. Now, in more complex scenarios, like having player being a struct type and modifying its values, I'd imagine this could be a problem. FOr now I will try to follow the tutorial as best as I can.

  • @10inall28
    @10inall285 ай бұрын

    Make quickly

Келесі