No video

Godot 3.0: Top-down Tank Battle - Part 5

  Рет қаралды 18,034

KidsCanCode

KidsCanCode

Күн бұрын

Welcome to a new tutorial series. Many of you have requested a full game tutorial, so I've chosen a top-down tank game. I have no idea how many parts this will be, but as we go we'll cover things like tilemaps, pathfinding, ai/behavior, and many other topics.
Art by Kenney: kenney.nl/asset...
Follow the written version of the series here:
kidscancode.org...
Code for this part can be downloaded here:
github.com/kid...
Support me on Patreon: / kidscancode

Пікірлер: 79
@Crisisdarkness
@Crisisdarkness 6 жыл бұрын
This tutorial I have yet to do, it is really impressive what you have managed to do in this game, I like the game mechanics that you have created, it brings me a childhood memory of a tank game that I played in a rather old console, thanks for your channel, you are helping many people from different parts of the world, thank you for be a good person.
@pomegranate8593
@pomegranate8593 11 ай бұрын
battle city maybe that old game was called :D
@upyours2707
@upyours2707 6 жыл бұрын
Even though I am already creating my own games, thanks to your Pygame tutorials that sparked my enthusiasm for creativity, I always come back and watch every new video you release. Sometimes I let your playlists run on my TV in the background while I do housework. Thank you!
@Kidscancode
@Kidscancode 6 жыл бұрын
Wow, that's great - thanks for the comment!
@fossegutten6579
@fossegutten6579 6 жыл бұрын
Best free Godot tutorial. Maybe also the best on the whole internet! Cant wait to see where this is going.
@Kidscancode
@Kidscancode 6 жыл бұрын
Thanks - I can't either!
@critacularofficial2374
@critacularofficial2374 5 жыл бұрын
Agreed; hands-down!
@BastiaanOlij
@BastiaanOlij 6 жыл бұрын
You did mention it sort of, but it is very important to highlight, the dot product only returns the cosine (and therefor the angle) of two vectors if the two vectors are unit vectors. If they are not you first need to normalize the vectors. Loving this serious btw, definitely going to use some of the ideas for the RTS I'm building but then in 3D :)
@Kidscancode
@Kidscancode 6 жыл бұрын
Yeah, I did mention that we had two unit vectors already, but good point on the clarification. BTW, I saw your terrain editor preview - can't wait to see how it turns out!
@BastiaanOlij
@BastiaanOlij 6 жыл бұрын
Yup you did mention it but not clearly, i’ve seen a few people getting into trouble (me included in moments my brain lets ne down) who forget to make sure they are using unit vectors:) Hope to have an update on the terrain editor on sunday:)
@Any_key404
@Any_key404 6 жыл бұрын
In a future episode you may need to adjust the raycasts to be more of a triangle as you stated because a level with tight turns that have obstacles will have the rays hitting them as the enemy comes to the turn. As with your series on 2.1 I appreciate the iterative nature of your videos and seeing the process of building things up rather than just tossing out a complete project/solution.
@Kidscancode
@Kidscancode 6 жыл бұрын
Indeed, we can refine as we go. I only want to do "good enough" at this point so we can get the overall framework of the game done. Since we're building it "together" and I don't have an already complete project to base the videos on, I expect we'll come up with ideas later that may change how we're doing things. It's the journey, not the destination!
@tralavala9808
@tralavala9808 6 жыл бұрын
Another great tutorial :)
@saddamoneil
@saddamoneil 6 жыл бұрын
Great video, thank you for your efforts.
@jozbornn
@jozbornn 5 жыл бұрын
I've encountered an error at 9:37. After I change the LookAhead raycast's collision mask, it still does not cause the enemies to slow and stop. I may just rewatch the entire video to see where I went wrong.
@diegomata1062
@diegomata1062 2 жыл бұрын
did you find the solution?
@prateekkarn9277
@prateekkarn9277 4 жыл бұрын
For the angle , take arccos of angle that you desire, so if you wish to fire when there is 45 degrees you take arccos(45)[degrees not radians] which would be (1/2)^(1/2)
@shardaojha7558
@shardaojha7558 Жыл бұрын
This tutorial is still very good. Anyone not able to set-radius. In third line of ready function write collisionshape2d.shape.set_radius(2.0) .it will work trust me brothers
@amirghalbarband3038
@amirghalbarband3038 4 жыл бұрын
Thank you for your tutorial and help , we all appreciate it
@gingerageousgames613
@gingerageousgames613 6 жыл бұрын
You are amazing as always. Thank you for that great tutorial.
@antanaspaskauskas9432
@antanaspaskauskas9432 6 жыл бұрын
Nice! Didn't know about dot product, now I can simplify my visual detection code! Thanks
@cultofape1000
@cultofape1000 6 жыл бұрын
Very nice. I see it´s time to get back to programming Godot!
@Mike-mv2uo
@Mike-mv2uo 3 жыл бұрын
In case it helps anyone, I was getting the error - Invalid call. Nonexistent function 'instance' in base 'Nil' - when the Enemy Tank was attempting to shoot. Turns out I stupidly missed out adding the EnemyBullet.tscn scene in the export variable 'Bullet', under the Enemy scene.
@markking1314
@markking1314 6 жыл бұрын
Loved your work. By the way, where do I request tutorials? I'd like to request tutorial for turn-based strategy games like fire emblem.
@Kidscancode
@Kidscancode 6 жыл бұрын
Thanks for the request. I don't know when I'll start another full game tutorial, but I'll keep the strategy idea in mind.
@SergioCandelaRamirez
@SergioCandelaRamirez 4 жыл бұрын
I keep going with this...It's amazing !! Truly amazing tutorial :) Part 5...CHECK
@Glankonian
@Glankonian 6 жыл бұрын
I'm having an interesting ... issue?... I have my enemy tanks passing each other on a double roadway. When they are both on screen they will independently, slowdown pause for a sec then start-up again. If my tank interacts with then individually, they behave as advertised. However, if I block one on the highway, the other will also stop when near me. If I unblock one but block the other, the first tank will proceed and the second will stop as expected. Until the first tank comes around again where it will again stop while unblocked. Strange behaviour... (I can send video...)
@Vejitasei
@Vejitasei 4 жыл бұрын
Just throwing this out for general ideas. My enemy tanks were firing just fine. I added the RayCast and they both stopped shooting?? And I can't get them to shoot anymore no matter what I change. Going to d/load the github code and look at everything one line at a time. BUT any ideas what would stop the bullets from firing when they were working before. Thanks in advance
@WamboxHD
@WamboxHD 6 жыл бұрын
This is gold.
@thewalkingkfc5894
@thewalkingkfc5894 4 жыл бұрын
Really nice tutorial! I've encountered a slight bug that I can seem to fix; the bullets that the enemy tank shoots seem to go through my player, but the bullets my player shoots dont. Any idea of that might be causing this?
@Kidscancode
@Kidscancode 4 жыл бұрын
At a guess, something to do with your collision layer/mask settings.
@kalleskit
@kalleskit 6 жыл бұрын
Hi, thank you so much for these tutorials! I really need some help. I'm well on my way with a top-down Tiled game, however I'm having serious issues with my Tile maps. All objects I place out get their coordinates really mixed up once loaded into my game! They end up nowhere near where they are supposed to be, and now they even seem to be mixing up the axes... Any idea what might be going on? Thanks!
@Kidscancode
@Kidscancode 6 жыл бұрын
I'm assuming "Tiled" is a typo and you're not using the Tiled Importer plugin. It's usually a good idea to click the "Lock" button after adding your TileMap node. This keeps you from accidentally moving the tilemap. I don't really know what you're describing, but on the left side where you see all the tiles, there are buttons for rotating/flipping tiles. Maybe you've hit one of those by mistake? Maybe you've set an offset in the tilemap properties?
@j.d.waterhouse4197
@j.d.waterhouse4197 6 жыл бұрын
Fantastic, let's do this!
@ivanmectin9106
@ivanmectin9106 2 жыл бұрын
wish you could teach us how to make a fighting game or a boxing game. :)
@heyyow6339
@heyyow6339 Жыл бұрын
the code for collision in detect radius doesn't work
@rluders
@rluders 6 жыл бұрын
Hey man... Great tutorial. Do you think to implement a multiplayer game for this tutorial? Or maybe in the feature using this same project?
@MsKocagoz
@MsKocagoz 6 жыл бұрын
Ricardo Lüders our master replied that question before, he said " it's on the list".
@Crisisdarkness
@Crisisdarkness 6 жыл бұрын
Hakan, do you know something about it, about the degree of difficulty, create multiplayer games in godot, is it complicated, or is it really not so?
@MsKocagoz
@MsKocagoz 6 жыл бұрын
Crisisdarkness hi darkness not yet, there is no more information
@leonk6950
@leonk6950 5 жыл бұрын
@@Crisisdarkness depends on if you're planning local multiplayer or global / hosted multiplayer. Local can be easily achieved ( he has a split screen tutorial) while global multiplayer needs a server and needs handling large amounts of logic server side, which is a very complex topic by itself
@Crisisdarkness
@Crisisdarkness 5 жыл бұрын
@@leonk6950 Thank you. I have a question for you. If I want to make a multiplayer game, by means of a peer-to-peer connection, that would be something easier to do, right?
@HeraldOD
@HeraldOD 5 жыл бұрын
Hey I really love these tutorials! However I've encountered a problem: my player tank no longer collides with enemies, and his bullets don't either. Enemies still shoot and their bullets correctly explode when they touch the player. I checked the collision masks for all the tanks and bullets, but I can't find where the problem is coming from. Any idea what could be causing this? EDIT: After further inspection, it appears I removed the enemy's CollisionShape2D instead of the DetectRange's. Now I feel kinda stupid
@Kidscancode
@Kidscancode 5 жыл бұрын
Glad you found it!
@j.d.waterhouse4197
@j.d.waterhouse4197 6 жыл бұрын
Everything is easy and clear for me...except when we start adding inherited scenes, this is my weak spot. If I can't see all the functions being used by a node right in front of me, my brain turns to jello lol
@BlazeAceKun
@BlazeAceKun 6 жыл бұрын
Enemy Tank shoots only first time and stop shooting after that anyone have this problem ?
@BlazeAceKun
@BlazeAceKun 6 жыл бұрын
solved it by connecting guntimer timeout in enemy script
@akimmahadi8641
@akimmahadi8641 4 жыл бұрын
Ace blaze thanks dude
@bakytkamchybekovichstndv1440
@bakytkamchybekovichstndv1440 6 жыл бұрын
Thank you for video
@mitchellstephens4228
@mitchellstephens4228 4 жыл бұрын
when i instance a second tank, it doesnt shoot bullets. when i duplicate it, it works fine. Im guessing this is similar to the issue we had with the collision shape; has anyone run into this / found a solution?
@djiexn
@djiexn Жыл бұрын
I have an error "' notexistent function "'instance"' in base 'NIL' Ok so we need set packedScene Bullet into enemies variablee In Inspector in map01 tab
@ArtER21
@ArtER21 4 жыл бұрын
I am learning a lot from this one but am still stuck on the enemy tanks accuracy, my project has the scale different with the tanks having more area in the camera window and a longer range but is otherwise the same. I tracked the problem down to when the target_direction is normalized but if I comment out the normalize call, the enemies turret snaps to the player location , so I cant seem to find a happy middle. I keep pressing forward and the tutorial is fun but I am stuck with an enemy tank that either aims way to fast or has a super exploitable weakness , I can pace the enemy tank at certain angles and it can not hit me. maybe I can make the enemy tank a radar with ray-cast activated on_body_entered and use the ray-cast rotation to lerp the turret rotation.
@Nobody-fm6ch
@Nobody-fm6ch 4 жыл бұрын
Enemy tank shoot only first time and stop shooting. Why?
@Kidscancode
@Kidscancode 4 жыл бұрын
Maybe you didn't connect the timer's "timeout" signal.
@muhanad102
@muhanad102 6 жыл бұрын
Awesome
@MattRose30000
@MattRose30000 6 жыл бұрын
Do you have to connect the shoot signals of every enemy to your map? What happens if you spawn enemies from script? How do you do it then?
@Kidscancode
@Kidscancode 6 жыл бұрын
enemy.connect('shoot', self, '_on_Tank_shoot')
@giggleghost3751
@giggleghost3751 5 жыл бұрын
4:50 is there a way to have all of these tanks connect themselves via code to the map script? It feels like a chore to connect all of them and it's easy to forget weather you've done it for all of them if you have a lot.
@giggleghost3751
@giggleghost3751 5 жыл бұрын
I am loving the tutorial by the way, this is huge help!
@Kidscancode
@Kidscancode 5 жыл бұрын
Of course, it can all be automated. We're just doing it manually at the beginning. The map script can call all the mobs in the group and connect their signals at once.
@RixtronixLAB
@RixtronixLAB 4 жыл бұрын
I got : Attempt to call function 'is_colliding' in base 'null instance' on a null instance. What's wrong with it ? thanks
@Kidscancode
@Kidscancode 4 жыл бұрын
"null instance" errors always mean the same thing: You've given a node name that doesn't exist. You didn't include the code that's producing the error, but check where you're calling `is_colliding` - it's referencing a nonexistent node. Most often this is because of misspelling the node name.
@russellchao2089
@russellchao2089 5 жыл бұрын
I’m having an error. When the enemy tank fires at the player tank, I get an error message saying: “Invalid set index ‘wait_time’ (on base: Timer) with value of type ‘Nil’.
@Kidscancode
@Kidscancode 5 жыл бұрын
You need to give gun_cooldown a value in the Inspector.
@russellchao2089
@russellchao2089 5 жыл бұрын
Oh i get it. I think ‘nil’ errors are inspector problems. Ill remember that for now on.
@Kidscancode
@Kidscancode 5 жыл бұрын
Not exactly. The error is telling you that "wait_time" has to be a number, but "gun_cooldown" has no value, ie "nil". It so happens that since we did "export var gun_cooldown" we can *set* its value in the Inspector, but it's not specifically Inspector related. You'd have the same problem if you had "var gun_cooldown" at the top, but fixing it would require you to change it to "var gun_cooldown = 0.5" for example.
@Stormhatt
@Stormhatt 6 жыл бұрын
Is there a way to set up the enemy shoot signalling system without having to connect the signal manually for each enemy?
@Kidscancode
@Kidscancode 6 жыл бұрын
You can set up signals in a script using `source_node.connect('signal_name', target_node, 'method_name')` I'll be setting it up later to automate, but we need to build some of the other systems out first.
@Stormhatt
@Stormhatt 6 жыл бұрын
Perfect, I'll try that out!
@frayjais2942
@frayjais2942 5 жыл бұрын
@@Kidscancode i know this is old, but would you put this in the level script? I keep getting an error telling me the shoot signal does not exist.
@Kidscancode
@Kidscancode 5 жыл бұрын
@@frayjais2942 The shoot signal is declared in the tank script.
@_fremdkoerper
@_fremdkoerper 5 жыл бұрын
after renaming "speed" to "max_speed" the player.gd says there is no such variable and the script variables in player.tscn are gone. Script variables for the Enemies work fine
@XenoFect
@XenoFect 5 жыл бұрын
Same problem, but fixed it by changing speed to max_speed in the script. I imagine 3.1 changes are the cause of this.
@hharoun3950
@hharoun3950 6 жыл бұрын
Hi, Thank you for the tutorial, highly appreciated. I have 2 issues. The first is that the Enemy Tanks continuously fire one shot after the other. I tried adjusting the gun cool down, but it does not seem to be having any effect. The second is that the set set_camera_limits(): does not seem to be working. When I use this code: func set_camera_limits(): var map_limits = $Ground.get_used_rect() var map_cellsize = $Ground.cell_size $Player/Camera2D.limit_left = map_limits.position.x * map_cellsize.x $Player/Camera2D.limit_right = map_limits.end.x * map_cellsize.x $Player/Camera2D.limit_top = map_limits.position.y * map_cellsize.y and run the game it shows me a blank screen. Your assistance in correcting this matter is highly appreciated.
@Kidscancode
@Kidscancode 6 жыл бұрын
It's really hard to say what's wrong without seeing your code, but it sounds like your gun cooldown timer isn't working at all. Check that you have the timeout signal connected and that in the shoot() function you're checking for is_stopped(). Also, make sure the gun timer is set to "One Shot". As for the map issue - are you sure you aren't getting an error in the Debugger window? If you add "print(map_limits)" there, does it show the size of your map (in tiles)?
@LittleMikeStarCraft
@LittleMikeStarCraft 5 жыл бұрын
edit: fixed
@sujataray6779
@sujataray6779 5 жыл бұрын
Whenever the player tank enters the detect radius. The game crashes. Please help me
@Kidscancode
@Kidscancode 5 жыл бұрын
If it's crashing, it's because you're getting an error. If you don't share the error, how can anyone possibly help you?
@sujataray6779
@sujataray6779 5 жыл бұрын
@@Kidscancode It is not showing any error.
Godot 3.0: Top-down Tank Battle - Part 6
16:34
KidsCanCode
Рет қаралды 15 М.
Godot 3.0: Top-down Tank Battle - Part 11: Pickups
13:32
KidsCanCode
Рет қаралды 8 М.
Пройди игру и получи 5 чупа-чупсов (2024)
00:49
Екатерина Ковалева
Рет қаралды 4,7 МЛН
나랑 아빠가 아이스크림 먹을 때
00:15
진영민yeongmin
Рет қаралды 14 МЛН
هذه الحلوى قد تقتلني 😱🍬
00:22
Cool Tool SHORTS Arabic
Рет қаралды 90 МЛН
Godot 3.0: Top-down Tank Battle - Part 10: Homing Missiles
15:21
KidsCanCode
Рет қаралды 10 М.
Godot 3.0: Top-down Tank Battle - Part 9
17:37
KidsCanCode
Рет қаралды 11 М.
Procedural Generation in Godot: Dungeon Generation (part 3)
24:45
This Godot 4 Scene Manager Does it ALL
28:50
Bacon and Games
Рет қаралды 25 М.
First 6 Months Learning Unreal Engine (No Programming Experience)
8:54
Godot 3.0: Top-down Tank Battle - Part 8
9:08
KidsCanCode
Рет қаралды 10 М.
Game Programming Patterns in Godot: The Command Pattern
14:41
GameDev w/ David
Рет қаралды 17 М.
Godot 3.0: Top-down Tank Battle - Part 12: Ammo
13:14
KidsCanCode
Рет қаралды 7 М.
Circle Jump: A Godot Mobile Game (Part 2)
20:01
KidsCanCode
Рет қаралды 16 М.
Пройди игру и получи 5 чупа-чупсов (2024)
00:49
Екатерина Ковалева
Рет қаралды 4,7 МЛН