Different ways to Collect Coins/Apples! || less than 5 lines of code! - Godot Engine Tutorial 2D

Learn how to get started in your journey to game dev! I hope this video helps you get started on this long but fun journey you plan on taking!
Thanks for watching my video!
Project Assets:
pixelfrog-assets.itch.io/pixe...
Download Godot 4.0:
downloads.tuxfamily.org/godot...
Join my Discord if want: / discord
Check out my twitch: / coffeeb4death
Check out my Patreon and support me: / cb4d
#godotengine #godot #gamedev #gamedevelopment #zerotohero

Пікірлер: 78

  • @DashMatin
    @DashMatinАй бұрын

    Thanks for the great explanation on everything. the efficient code the animation and all ☺

  • @tingkoydesu1837
    @tingkoydesu1837 Жыл бұрын

    thank you for this, I've been searching yt yesterday for this this is exactly what i need

  • @CodingQuests

    @CodingQuests

    Жыл бұрын

    Glad I could help!

  • @tingkoydesu1837

    @tingkoydesu1837

    Жыл бұрын

    i tried the tween_callback in godot 3.5.1 the game crashes when it collides with the object. are you using godot 4?

  • @CodingQuests

    @CodingQuests

    Жыл бұрын

    @@tingkoydesu1837 yeah I'm using Godot 4, you might want too look at Godot 3.5 documentation if you wanna use the callback

  • @gul7675
    @gul76753 ай бұрын

    exactly what I needed. thanks

  • @CariTauGan
    @CariTauGan Жыл бұрын

    i request this on discord yesterday. thanks man, that was fast

  • @CodingQuests

    @CodingQuests

    Жыл бұрын

    Hope you enjoyed it!

  • @CariTauGan

    @CariTauGan

    Жыл бұрын

    @@CodingQuests definitely

  • @martinithechobit
    @martinithechobit8 ай бұрын

    You are the real mvp.

  • @GrunkleSoos
    @GrunkleSoos Жыл бұрын

    I'd be really interested in a video on randomized enemies from a spawner. Like the first one out of the spawner is normal, then fast, then tanky.

  • @wkppp4732
    @wkppp4732 Жыл бұрын

    Thanks for the vid! Btw the sprite is cute 🤣 I still preferred tween though 🤣

  • @CodingQuests

    @CodingQuests

    Жыл бұрын

    Yeah me too, i think its a lot more flexible!

  • @lakijacim3008
    @lakijacim3008Ай бұрын

    Great tutorial works on 4.2.2 godot!

  • @rendcycle
    @rendcycle Жыл бұрын

    How do you make this as a loot/reward and make the item only appear after an enemy is vanquished? Also, is it possible to have an Area2D item have a gravity so it falls on the floor after appearing?

  • @martinzthabo5341
    @martinzthabo534117 күн бұрын

    Good explaination

  • @GGAMER232
    @GGAMER232Ай бұрын

    the apple wont disappear for me. Anyone able to help?

  • @suchsneak3545
    @suchsneak3545 Жыл бұрын

    Should I use this method if I plan to do lets say 100-200 collectables in a level? Or is there a more optimised way? First time working with godot so I don't know what the engine is capable of yet.

  • @CodingQuests

    @CodingQuests

    Жыл бұрын

    to my knowledge, this is pretty much the best way to add collectables with flexibility. if you want to optomize ur game, thats a different story. generally godot wont process things that you cant see, so if u hide it when its not on ur screen thatd help with optimizing ur game!!

  • @suchsneak3545

    @suchsneak3545

    Жыл бұрын

    @@CodingQuests thanks for the answer! Btw, love your channel. You stand out cause I can tell you really do enjoy learning about the code and explain more ways that one to achieve a result

  • @novembro7603
    @novembro76033 ай бұрын

    What if need tween that money or fruit to the screen's corner and this position gets move it self like the Camera2D?

  • @CodingQuests

    @CodingQuests

    3 ай бұрын

    tween it to that position then.

  • @novembro7603

    @novembro7603

    3 ай бұрын

    ​@@CodingQuests 😂 Yup, I did it!! Just writing the global position under the _process(delta) function's line. and it was done.. Thanks.

  • @dupasmokagaming700
    @dupasmokagaming7007 ай бұрын

    Hi! Love your video bud! I am a beginner in this stuff - just started, and it helps me a lot! Sorry was searching your channel - looking for a vid where you explain how to collect / gather these coins? where can i find it? I mean using this function from this vid Game.Coins = +10 Can you explain how can i Update a Variable in my Player node with this value? many thanks!

  • @CodingQuests

    @CodingQuests

    7 ай бұрын

    this video should do that...?

  • @dupasmokagaming700

    @dupasmokagaming700

    7 ай бұрын

    hey sorry was in a bit rush when I wrote it, perhaps wasn't clear enough. Anyway I have just figured it out. Thanks for the reply though! cheers

  • @TRFWINGS

    @TRFWINGS

    Ай бұрын

    i think you mean Game.Coins += 10 and that will update the var?

  • @Shawn-cq7qy
    @Shawn-cq7qy9 ай бұрын

    Oh can you make a video on how to fix stuff it not working for all I fix my but so other is still trying to get to work so can you make a video on it to help the others I wish could but my parents won’t let me😢

  • @Shawn-cq7qy

    @Shawn-cq7qy

    9 ай бұрын

    So are you going to make a video on it

  • @Shawn-cq7qy
    @Shawn-cq7qy9 ай бұрын

    Can you do on 3d or it won’t work I can’t find any videos on it please help

  • @CodingQuests

    @CodingQuests

    9 ай бұрын

    you can yes!

  • @Shawn-cq7qy

    @Shawn-cq7qy

    9 ай бұрын

    Thx you I am going to go sub to thx

  • @Shawn-cq7qy

    @Shawn-cq7qy

    9 ай бұрын

    So for 3d do you need a static body 3d for the coin or no

  • @CodingQuests

    @CodingQuests

    9 ай бұрын

    @@Shawn-cq7qy if you need more help, you can join the server!

  • @Shawn-cq7qy

    @Shawn-cq7qy

    9 ай бұрын

    Is it on discord

  • @gogagawtherobloxboy248
    @gogagawtherobloxboy2485 ай бұрын

    in my platformer I did not watch this vid and we used the same asset pack!

  • @CodingQuests

    @CodingQuests

    5 ай бұрын

    Awesome!

  • @darkhunter777
    @darkhunter777Ай бұрын

    Забыл вывести число собранного 😁

  • @poper8960
    @poper89607 ай бұрын

    Does the code work differently for 3D because it's not working for me

  • @CodingQuests

    @CodingQuests

    7 ай бұрын

    no it should be the same. aside from having a 3rd axis?

  • @poper8960

    @poper8960

    7 ай бұрын

    @@CodingQuests I managed kind of just the collisions are different because of all the different bodies

  • @TRFWINGS

    @TRFWINGS

    Ай бұрын

    The Area2D has to be Area3D instead

  • @engigner
    @engignerАй бұрын

    My collectable isn't even playing the idle animation, can you help?

  • @An0.nym0us

    @An0.nym0us

    Ай бұрын

    Try to see if you clicked autoplay

  • @engigner

    @engigner

    Ай бұрын

    @@An0.nym0us Where's the autoplay button?

  • @An0.nym0us

    @An0.nym0us

    Ай бұрын

    @@engigner its between the drop down select thingy where you can select tracks and the edit button

  • @TRFWINGS

    @TRFWINGS

    Ай бұрын

    press autoplay

  • @nothomka
    @nothomka11 ай бұрын

    What to do if item doesn’t disappear

  • @aierisfrost8447

    @aierisfrost8447

    10 ай бұрын

    Having same problem

  • @Shawn-cq7qy

    @Shawn-cq7qy

    9 ай бұрын

    Have the same problem too

  • @Shawn-cq7qy

    @Shawn-cq7qy

    9 ай бұрын

    Did one of you find how to fix it

  • @aierisfrost8447

    @aierisfrost8447

    9 ай бұрын

    @@Shawn-cq7qy I am afraid we are all waiting for someone to help us pal

  • @Shawn-cq7qy

    @Shawn-cq7qy

    9 ай бұрын

    Are you useing 3d or 2d

  • @LuisFelipe-pq9lr
    @LuisFelipe-pq9lr7 ай бұрын

    The soluction I used was to add a 'on body exited', for its working well ``` func _on_body_exited(body): queue_free() ``` Full Code: ``` extends Area2D @onready var sprite_2d = $Sprite2D static var score = 0; # I am using static so when I grab another apple the score dont reset to 0 func _on_body_entered(body): if body.name == "Player": sprite_2d.animation = "collected" func _on_body_exited(body): queue_free() ```