[Godot 4] Adaptable Drag&Drop in 10 Minutes

Поділитися
Вставка
  • Опубліковано 15 вер 2024
  • code:
    pastebin.com/L...
    the icon of the timer at 3:45 :
    www.svgrepo.co...
    svgrepo is a place to download free SVG vectors and icons for commercial use, check them out!
  • Ігри

КОМЕНТАРІ • 28

  • @copygirl
    @copygirl Рік тому +14

    An additional check for testing whether an input is a tap is to test how far the mouse is moved from the point of the initial press. That is, only consider an input to be a tap if the release was close to the initial press. This way, players who are just trying to play the game very quickly won't be annoyed by the game thinking they did a tap when they already moved the card halfway over the scene to where they wanted it to go.

  • @iggymoeplays7015
    @iggymoeplays7015 11 днів тому

    Clever construct. Thanks for the ideas.

  • @Pinkamingo
    @Pinkamingo Рік тому +2

    I liked this tutorial very good explained and I will implement it in my card game
    thanks this was a great help to me :D

  • @DrNabeel20
    @DrNabeel20 10 місяців тому +1

    High quality video, Thanks

  • @Am3ricium
    @Am3ricium 11 місяців тому +2

    just a thought:
    what if you just set object to picked at the button down event right away in any case, and just ignore any button up events before timer runs out
    this way if you hold it and release button after timer, its working, and if you tap it and tap again after timer runs out, the second tap button up event will trigger release
    you can't drop the object during timer anyway

    • @ciosai_tw
      @ciosai_tw  11 місяців тому

      hey that sounds good, i should try that out

  • @aucer7904
    @aucer7904 8 місяців тому +1

    Treasure channel!

  • @JasonMorelandDigitalrecline

    excellent tutorial well made and vary informative. going to work this into my game 🙂

  • @bramdonamo
    @bramdonamo 11 місяців тому

    Wildfrost was made in Unity, Unity has built in interfaces for checking if a UI element was clicked or dragged so that's how they would have achieved this

    • @ciosai_tw
      @ciosai_tw  11 місяців тому

      ah i thought the devs did this themselves lol, thanks for telling!

    • @bramdonamo
      @bramdonamo 11 місяців тому

      I've been a Unity dev for 5 years and the recent events surrounding the engine have me looking into Godot as an alternative, so far its been relatively smooth transitioning to the new engine but I do wish Godot had more UI features, your video has given me some ideas for implementing a similar UI event system that Unity has into Godot

  • @snaker90
    @snaker90 3 місяці тому

    Nice Sulotion, Thank you!

  • @nightfox_69
    @nightfox_69 2 місяці тому

    Please make a complete course for a card game!!

  • @marcsles
    @marcsles 8 місяців тому

    I want that swinging thing so badly

    • @ciosai_tw
      @ciosai_tw  8 місяців тому +2

      me : haha babies are so silly, amused by things being dangly
      me when the game has visual feedback : me want shiny dangly NOW

  • @MrSirFluffy
    @MrSirFluffy 11 місяців тому +1

    Woah, how did you do those flip effects at 0:09? I thought you couldn't flip in 2d?

    • @ciosai_tw
      @ciosai_tw  11 місяців тому

      thats a game called WildFrost im playing, i didnt make it

    • @gablanwheel3895
      @gablanwheel3895 10 місяців тому

      I would assume Wildfrost is using 2D assets in 3D space, so they are “actually” being flipped. But you can accomplish a similar effect in 2D by animating a card back sprite’s scale.x to 0 and a card front sprite’s scale.x to 1. I do something like that in Godot using Tween methods to get the timing right, it’s pretty effective.

  • @tm001
    @tm001 10 місяців тому

    Regarding the tap to drag, why not just use the built-in Toggle Mode? does it have a downside or something?

    • @ciosai_tw
      @ciosai_tw  10 місяців тому

      going to try that out. will get back to you

    • @ciosai_tw
      @ciosai_tw  10 місяців тому

      couldnt think of a way to make it adaptable, maybe if tap/hold is an explicit option in the settings of the game it would work?

  • @cq7743
    @cq7743 Рік тому

    l like it!that's very helpful.Can l share your video to other web with link?

    • @ciosai_tw
      @ciosai_tw  Рік тому

      sure! may i ask where?

    • @cq7743
      @cq7743 Рік тому

      @@ciosai_tw The website in China is called Bilibili😀

    • @ciosai_tw
      @ciosai_tw  Рік тому

      @@cq7743 沒問題,不過華語區真的有人要看godot嗎?

    • @cq7743
      @cq7743 Рік тому

      @@ciosai_tw 有的。在國內的網站上,關於Godot的資源不多,有時找不到想要的訊息,所以我選擇自己學習的同時搬運視頻,幫助更多的人解決他們的問題

  • @franfy2914
    @franfy2914 10 місяців тому +1

    I think it work to remove the 0.1s lag
    func _on_pressed() -> void:
    if not picked_up :
    picked_up = true
    $Timer.start()
    await mouse_released
    if $Timer.is_stopped() :
    picked_up = false
    else :
    picked_up = false

    • @ciosai_tw
      @ciosai_tw  10 місяців тому +1

      oh that looks good!