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
Thanks for the great explanation on everything. the efficient code the animation and all ☺
thank you for this, I've been searching yt yesterday for this this is exactly what i need
@CodingQuests
Жыл бұрын
Glad I could help!
@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
Жыл бұрын
@@tingkoydesu1837 yeah I'm using Godot 4, you might want too look at Godot 3.5 documentation if you wanna use the callback
exactly what I needed. thanks
i request this on discord yesterday. thanks man, that was fast
@CodingQuests
Жыл бұрын
Hope you enjoyed it!
@CariTauGan
Жыл бұрын
@@CodingQuests definitely
You are the real mvp.
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.
Thanks for the vid! Btw the sprite is cute 🤣 I still preferred tween though 🤣
@CodingQuests
Жыл бұрын
Yeah me too, i think its a lot more flexible!
Great tutorial works on 4.2.2 godot!
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?
Good explaination
the apple wont disappear for me. Anyone able to help?
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
Жыл бұрын
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
Жыл бұрын
@@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
What if need tween that money or fruit to the screen's corner and this position gets move it self like the Camera2D?
@CodingQuests
3 ай бұрын
tween it to that position then.
@novembro7603
3 ай бұрын
@@CodingQuests 😂 Yup, I did it!! Just writing the global position under the _process(delta) function's line. and it was done.. Thanks.
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
7 ай бұрын
this video should do that...?
@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
Ай бұрын
i think you mean Game.Coins += 10 and that will update the var?
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
9 ай бұрын
So are you going to make a video on it
Can you do on 3d or it won’t work I can’t find any videos on it please help
@CodingQuests
9 ай бұрын
you can yes!
@Shawn-cq7qy
9 ай бұрын
Thx you I am going to go sub to thx
@Shawn-cq7qy
9 ай бұрын
So for 3d do you need a static body 3d for the coin or no
@CodingQuests
9 ай бұрын
@@Shawn-cq7qy if you need more help, you can join the server!
@Shawn-cq7qy
9 ай бұрын
Is it on discord
in my platformer I did not watch this vid and we used the same asset pack!
@CodingQuests
5 ай бұрын
Awesome!
Забыл вывести число собранного 😁
Does the code work differently for 3D because it's not working for me
@CodingQuests
7 ай бұрын
no it should be the same. aside from having a 3rd axis?
@poper8960
7 ай бұрын
@@CodingQuests I managed kind of just the collisions are different because of all the different bodies
@TRFWINGS
Ай бұрын
The Area2D has to be Area3D instead
My collectable isn't even playing the idle animation, can you help?
@An0.nym0us
Ай бұрын
Try to see if you clicked autoplay
@engigner
Ай бұрын
@@An0.nym0us Where's the autoplay button?
@An0.nym0us
Ай бұрын
@@engigner its between the drop down select thingy where you can select tracks and the edit button
@TRFWINGS
Ай бұрын
press autoplay
What to do if item doesn’t disappear
@aierisfrost8447
10 ай бұрын
Having same problem
@Shawn-cq7qy
9 ай бұрын
Have the same problem too
@Shawn-cq7qy
9 ай бұрын
Did one of you find how to fix it
@aierisfrost8447
9 ай бұрын
@@Shawn-cq7qy I am afraid we are all waiting for someone to help us pal
@Shawn-cq7qy
9 ай бұрын
Are you useing 3d or 2d
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() ```