SUPER EASY 2D DESTRUCTIBLE TERRAIN in Godot

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

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

  • @DerpyNinjaFrog
    @DerpyNinjaFrog Год назад +7

    2:55 you can transform the polygon like this: "var offset_poly = Transform2D(0, poly.global_position) * poly.polygon"
    note: here offset_poly is the list of points not a Polygon2D, so later when you clip them pass in offset_poly not offset_poly.polygon

  • @RhevoRamirez
    @RhevoRamirez Месяц назад

    Thanks dude, but you didn't show the whole code inside the bullet scene. What should the "collider" variable be inside that code? Thanks

  • @dexter2333
    @dexter2333 Год назад +4

    in version 4.1 it doesn't work.
    Please do you know what the new code would be like?

    • @mrelipteach
      @mrelipteach  Год назад +1

      I don't really know why it wouldn't work. Do you have an error or something?

    • @AlamarsDomain
      @AlamarsDomain Год назад +3

      The Geometry class is now Geometry2D, so you can mass replace that, and then comment out update()

    • @Codon_N_Y
      @Codon_N_Y 5 месяцев назад

      ​@@mrelipteach
      I think we do not understand the ready-made codes because they confuse the recipient It is ready information In the end, I don't know why I love you so much

  • @monarxk
    @monarxk Год назад +5

    Good video. It would be a lot more beginner friendly if you highlighted the elements you're referring to on screen somehow so that your explanation is easier to follow. Thank you for the vid.

  • @MeBadDev
    @MeBadDev 2 года назад +6

    For peoples who want 'islands':
    add this code under the setting polygon stuff
    if res.size() > 1:
    var island := Polygon2D.new()
    var island_collision := CollisionPolygon2D.new()
    island.polygon = res[1]
    island_collision.set_deferred('polygon',res[1])
    add_child(island_collision)
    add_child(island)
    yeah its bad but its working :D

    • @saslow_dev
      @saslow_dev Год назад +1

      Your version can only have two "islands". Here is an improved version with an infinite number of "islands":Your version can only have two "islands". Here is an improved version with an infinite number of "islands":
      if res.size() > 1:
      for i in range(len(res)):
      var island := Polygon2D.new()
      var island_collision := CollisionPolygon2D.new()
      island.polygon = res[i]
      island_collision.set_deferred("polygon", res[i])
      $collision.add_child(island_collision)
      add_child(island)

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

      @@saslow_dev Yeah thats better, tjamls!

    • @saint-frog
      @saint-frog 10 месяцев назад +2

      @@saslow_dev I'm trying to implement this, but when I create an island, the entire polygon turns white and loses all collision. What is the $collision referred here?

    • @mingamerking
      @mingamerking 6 месяцев назад

      @@saint-frog I think it refers to the destructible static body

  • @mrdinoking6626
    @mrdinoking6626 2 года назад +3

    Hey ! Loved the tutorial :) . I had a problem with the implementing of the terrain destruct though. Whenever i fire the missiles at a same spot for two three times , the destruction stops working and the engine gives me decompose_polygon_in_convex: Convex decomposition failed! error. And as such when i enable visible collision shapes , whole collision shape gets deleted after the third missile hitting the same spot. Could you highlight what the problem could be?

  • @musplaygame
    @musplaygame Год назад +1

    hermoso... como puedo hacer la linea que te indica la dirección del proyectil... así como la que hiciste en tu juego

    • @mrelipteach
      @mrelipteach  Год назад +1

      I made a video about that specifically ruclips.net/video/Mry6FdWnN7I/видео.html

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

    Its was really helpful. Thank you

  • @Dave-wj6ic
    @Dave-wj6ic Год назад +1

    Great tutorial! I am trying to create similar terrain, is there tutorial on how to do it?

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

      Thanks! I have a video on using path2D, polygon2D ,etc.. you'll find what you need: ruclips.net/video/nt98ROm_Jrs/видео.html

    • @Dave-wj6ic
      @Dave-wj6ic Год назад

      @@mrelipteach wow, this is exactly what I needed! Thank you!

  • @musplaygame
    @musplaygame 5 месяцев назад

    funciona en godot 4

  • @Nephanor
    @Nephanor 7 месяцев назад

    Any chance of updating this to Godot 4? I tried things as you had them here and a lot of the stuff has changed.

    • @mrelipteach
      @mrelipteach  7 месяцев назад

      I can't promise anything. It would take a lot of time to go through the many experiments and update them.

    • @Nephanor
      @Nephanor 7 месяцев назад

      @@mrelipteach I got some aspects of it worked out, but I am sure I am missing something. And I even made mine simpler, was only doing bullets that don't even arc, just drop straight down (space invaders type game, pillboxes are what I want to have destroyed) but it's still not working right. . Like now it's PackedVector2Array, Geometry2D.clip_polygons, and so on, but still....no luck.

  • @AppMaker728
    @AppMaker728 3 месяца назад

    Wicked awesome godot is

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

    Hey all !
    This tutorial is perfect for what I need but I wanted to know if anyone knew if it's possible to turn this kind of flat plane into a 3d object.
    Give it a thickness.
    Like Worms Revolution or Battlegrounds ?

  • @ivanrzhanoy9389
    @ivanrzhanoy9389 5 месяцев назад +1

    I have discovered the issue with this project. Clipping only works if destructible object is at coordinates 0,0.
    It can sort of work if it's close to 0,0 and destruction polygon can cover the difference, but clipping still takes at wrong place.
    I am trying to fix it. It seems that local coordinate points of Polygon need to be transformed to their global position in scene but I don't know how. "$Polygon2D.polygon" in "var res = Geometry2D.clip_polygons($Polygon2D.polygon, offset_poly.polygon)" should be replaced to global values.
    So if let's say the object is located at 100, 100, the first retrieved value of point in "$Polygon2D.polygon" should be 100, 100 instead of 0,0
    EDIT: Fixed code:
    var offset_poly = Transform2D(poly.get_parent().get_parent().rotation, poly.global_position) * poly.polygon
    var global_polygon: PackedVector2Array = Transform2D(0, $Polygon2D.global_position) * $Polygon2D.polygon #

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

    Having tough time to digest the code❤❤❤

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

    Really helpful