Laser beams in Godot 3.2 (using a RayCast2D)

Поделиться
HTML-код
  • Опубликовано: 21 окт 2024

Комментарии • 62

  • @uheartbeast
    @uheartbeast  4 года назад +6

    Hope you all enjoy the video! I'm going to start uploading Godot Action RPG videos next week!
    Here is the original article by Kemono Games (it was made using Godot 2 I think): kemonogames.tumblr.com/post/145440294136/how-to-create-plasma-beams
    Kemono Games' Twitter: twitter.com/KemonoGames
    Have a great weekend! - Ben
    P.S. If you haven't checked it out yet, here is my Godot course: www.heartgamedev.com/1-bit-godot-course-youtube
    [edit] forgot to link to the github for the source code/resources: github.com/uheartbeast/youtube-tutorials

  • @RedEyedJedi
    @RedEyedJedi 7 месяцев назад +3

    This isn't just a great tutorial. it's also a great lesson on how to program. First, know exactly what you want to achieve. Secondly, divide that problem into many smaller problems and then start solving these smaller problems until you have completed the bigger problem. Thank you for the video. It was very helpful.

  • @braveblade87
    @braveblade87 7 месяцев назад +2

    In GODOT 4.0 RayCast's cast_to was renamed to target_position

  • @TimmyBobimmy
    @TimmyBobimmy 4 года назад +22

    Hey dude your content is super awesome, and you inspired me to stick with the Godot engine when I was about to uninstall it, and now I love using it to make games. Keep up the great content. Thanks.

  • @adamsmiddy
    @adamsmiddy 4 года назад +23

    "Good morning, afternoo-" presses like cause HeartBeast

  • @vigneshs2886
    @vigneshs2886 4 года назад +5

    Good lord I was literally searching for this yesterday and I couldn't find it. It seems like you made this video just for me lol. Thanks a lot.

  • @AniMesuro
    @AniMesuro 4 года назад +10

    Thank you so much. I've been trying to figure out how to make art-heavy backgrounds with polygons, as in Once Upon a Coma, and didn't know how to start. Never thought about stealing CollisionPolygon2D's polygon to Polygon2D from a script.
    Didn't expect to learn it from a laserbeam tutorial tho.
    Now with this in mind I think I'll try to make a script to fill the border with grass sprites.

    • @antonioedmilson1810
      @antonioedmilson1810 4 года назад

      You can make the collision polygon2D follow the sprite length? helpppp

    • @kmeadows100
      @kmeadows100 2 года назад

      Agreed. That little 10 second trick saved countless people countless time.

  • @davidphillips9366
    @davidphillips9366 4 года назад +1

    Thanks for such great tutorials! I've always been interested in game development but I had never tried it until I started watching your videos. Im so glad you take the time to explain why things work the way they do and you don't just right a bunch of code and then vaguely explain what it all does.

  • @nabilandadamslaboratory3422
    @nabilandadamslaboratory3422 4 года назад +1

    Please keep with the Godot videos! Gamemaker is outclassed now.

  • @Ric_93
    @Ric_93 4 года назад +3

    I needed this! Thank you so much Benjamin!!

    • @uheartbeast
      @uheartbeast  4 года назад +5

      You're welcome! I love your videos. It's good to see you here :)

    • @Ric_93
      @Ric_93 4 года назад +3

      @@uheartbeast oh wow, thank you for watching! You're the one who initiated me to pixel art! ☺️ I bought all your pixel art courses on Udemy! I made my very first pixel art sprites watching your tutorials

  • @jinshiro
    @jinshiro 4 года назад

    Planned to add mining lasers to my game today, perfect timing. Now I have a reference for implementation.

  • @KlausWulfenbach
    @KlausWulfenbach 4 года назад +2

    Time to add a laser weapon to my Metroidvania game!

  • @kennethmkline23
    @kennethmkline23 4 года назад +1

    I really miss your Gamemaker tutorials :)

  • @stevenjadamo
    @stevenjadamo 4 года назад

    Definitely filing this one aware for future use... thanks Ben!

  • @TackerTacker
    @TackerTacker 4 года назад +4

    Great tutorial. I think you should post your videos on the Godot discord, they have a channel for sharing tutorials.

  • @michaelcapone175
    @michaelcapone175 4 года назад +1

    Great tutorial Ben. Taught me something. Thank you.

  • @mazimadu
    @mazimadu 4 года назад +2

    Looks like you have been making good progress using Godot.
    How do you feel it fairs compared to GameMaker studio 2?

  • @mertgulec7541
    @mertgulec7541 8 месяцев назад +1

    Still useful. I am glad this tutorial exists because all other are just copy paste and no explanation

  • @mahmoud.zayedd
    @mahmoud.zayedd 4 года назад

    Hope do the same in Game maker 💙

  • @RDHardy79
    @RDHardy79 4 года назад +7

    For me, and I followed absolutely ever single step twice (I started all over again the first time this problem happened) but every time I try to run the game from the world scene with the collision objects in place, the laser doesn't track the mouse. Tracks it just fine in the laser scene but not in the world scene.
    The error :
    Line 9 (UNUSED_ARGUMENT):The argument 'delta' is never used in the function '_physics_process'. If this is intended, prefix it with an underscore: (ignore) '_delta'
    The debugger states: Invalid call. Nonexistent function 'get_Collision_point' in base 'RayCast2D.
    Mind you, the code is identical what gives?
    Okay so, I figured it out as I was composing this. I'm keeping this comment to maybe help others. 'get_Collision_point' is invalid due to the simple fact that there is no such thing as get_Collision_point in GDOT, there is a get_collision_point.SEE IT?? I had Collision capitalized and thus the whole code was bunk. that is stupid as hell, but oh well. I'm learning. Thanks for the videos.

    • @uheartbeast
      @uheartbeast  4 года назад +4

      Thanks for posting this to help others. Small typos like that are very common and can be super frustrating. Everyone makes them and it is part of learning to code. I'm glad you were able to work it out.

  • @CamiloS2001
    @CamiloS2001 2 года назад +1

    thank you

  • @antonioedmilson1810
    @antonioedmilson1810 4 года назад +1

    Thank you so much!

  • @tomf4927
    @tomf4927 3 года назад +3

    Thanks for this! However, I discovered a little problem. The raycast stops while the beam image continues to extend itself if it isn't colliding. I solved this by altering the if/else statements. if colliding: beam.region_rect.end.x = end.position.length(), else: beam.region_rect.end.x = end.global_position.length()

    • @DoubleDotStudio
      @DoubleDotStudio Год назад

      I followed the tutorial and edited parts for Godot 4.0. This solved an issue of the beam being too short. 😄

    • @DoubleDotStudio
      @DoubleDotStudio Год назад

      If you have a larger window then you have to make the max_cast_to variable larger or the beam will ignore collisions because the raycast is too short and it will treat it as an else statement.

  • @Aahaah8
    @Aahaah8 4 года назад

    Thank you so much for this tutorial, this is exactly what I've been looking for! So simply explained, you are awesome!

  • @25w-g6c
    @25w-g6c 4 года назад

    Thank you so much for this

  • @ghb323
    @ghb323 3 года назад

    Not to be confused as a short laser projectile that travels A LOT slower.

  • @ZetaCarinae
    @ZetaCarinae 4 года назад

    Super helpful thank you!

  • @MM-ym8kk
    @MM-ym8kk 4 года назад

    why multiplying by MAXLENGHT if you going to use normalized() will it not be scaled to 1
    var max_cast_to = mouse_postion.normalized() * MAX_LENGHT

  • @cristianinujazznight3044
    @cristianinujazznight3044 4 года назад

    Thank you for the video.

  • @antonioedmilson1810
    @antonioedmilson1810 4 года назад +1

    You can helpe me? My laser have a Collision Polygon2D, and i want to that Polygon2D too extends to the collision point of raycast, same of sprite. Can you helpe please?
    love your videos

  • @JimmyCrackorn
    @JimmyCrackorn 4 года назад

    Will you do a follow-up to go over setting up the beam to reflect off of surfaces when there's a collision and making it respond to input instead of always being on?

  • @NidonocuPoisonBunny
    @NidonocuPoisonBunny 4 года назад

    Can I ask how Godot is configured to remove 3D related things?

  • @th-bl7fd
    @th-bl7fd 7 месяцев назад

    Thank you.

  • @DrNabeel20
    @DrNabeel20 4 года назад

    Thank you this is amazing! 💯💯

  • @covereye5731
    @covereye5731 Год назад

    Not sure how you would use region rect that way if you were pulling the beam from a spritesheet.

  • @ivanzelta3609
    @ivanzelta3609 3 года назад

    I LOVE THIS GUY

  • @seewhale8565
    @seewhale8565 4 года назад

    Hi Ben, could you redo the top-down rpg in Godot which you previously did in Gamemaker?

  • @veltsu9
    @veltsu9 4 года назад

    That is very handy! +1
    Now I wonder how would a laser beam work, which gets reflected from the walls...?

  • @IndieLibre
    @IndieLibre 4 года назад

    Muchas gracias!

  • @kylin3197
    @kylin3197 4 года назад

    very cool! awesome vid!

  • @jackwinner4810
    @jackwinner4810 4 года назад

    Hello Mr. HeartBeast thank you very much for your Tutorial. I don't
    I don't undestand english but I understand all that you did.
    You inspirate me to do VideoGames
    Thank you very much and God Bless you and your family!!!!

  • @Gost-nf3cr
    @Gost-nf3cr 4 года назад +1

    do you can make a download of all your tutorial projekts that would be very nice

    • @halobread
      @halobread 3 года назад +1

      no its a tutorial
      you're meant to learn not steal

    • @Gost-nf3cr
      @Gost-nf3cr 3 года назад

      @@halobread i do learn better by messing around with stuff

  • @CAl_9000
    @CAl_9000 4 года назад

    Curiously this doesnt work when instanced as a child of my player character but works fine when instanced directly in the world

    • @rhysjones8105
      @rhysjones8105 2 года назад

      Very late to this, but did you set the collision layer of your player to be separate from the collision mask of the laser?

  • @Joshua-kr5fq
    @Joshua-kr5fq 4 года назад

    when will you be doing networking?

  • @tjwinn4931
    @tjwinn4931 4 года назад +1

    Pogchamp

  • @godonholiday
    @godonholiday 4 года назад

    Quality

  • @pompyproductions5644
    @pompyproductions5644 3 года назад +1

    ~wherever and whenever you are, my name is Benjamin~ _here have a like_

  • @me2beats313
    @me2beats313 4 года назад

    Cool:)

  • @KFSENSEI
    @KFSENSEI 4 года назад +2

    like

  • @Archive-w5s
    @Archive-w5s 4 года назад

    the like/dislike ratio tho ....