
Godot 3.0: Top-down Tank Battle – Part 1
KidsCanCode
Views: 91282
Like: 1611
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.
Note: If you’re a complete beginner in Godot, you should start here first:
Art by Kenney:
Follow the written version of the series here:
Code for this part can be downloaded here:
Support me on Patreon:
15.06.2022
New tutorial from senpai. The day starts good!
I sent you an email. Did you get it?
This is a pretty damn good concept !
Thank your time and efforts !
Awesooooome~!
<3
Like always I have some problems, this time: [Invalid set index 'wait_time' (on base: 'Timer') with value of type 'Nil'.] I typed everything like on the video.
Bro can you help in making 2d neon lights for platformer game in Godot, I'm trying but getting confused. Please help
Loving your tutorial series, you have excellent way of teaching, i also got my son to watch, as he loves computers, and he interested in making games.
Thank you so much for your videos :o)
More Please!!
I learned much more than i expected in this short video :O
What if I wanted to use a controller? How would I set the muzzle rotation to the right analogue stick?
Awesome!
Great tutorial! 😀 And yes, Use Pixel Snap gets rid of some annoying graphical glitches when you are using tile-maps, so make sure its on!
Invalid call. Nonexistent function 'control' in base 'KinematicBody2D (Player.gd)'. help me pls
on line 25 problem
and why can not I start the stage until I designate the main scene?
Hello, I did it. but when I deleted the code in the general script and decided to reintroduce the code of your code into it, I got it
Invalid set index 'wait_time' (on base: 'Timer') with value of type 'Nil'.
before that the tank was working and moving, and when I decided to remove the code for fun, and again that code did not come out for me. I think the engine does not work well because it does not recognize the same code
For beginners like myself, when you want to rotate any sprite sheet so things face right, just go to PXLR Editor online, and use 'Free Transform' to rotate it. It's Simple and easy!
How do you change the character in the editor that represents the indents? By default it looks like a >| but you have just a " which looks nicer imho.
Would you be able to show making mobile game and multiplayer through localhost server and client? Your tutorials are very helpful, thank you for all your work.
Ты супер!
That Texture Region selector is super useful, never seen that before 🤯
Why is my tank not moving? 🙁
Rotated assets! https://raw.githubusercontent.com/kidscancode/topdown_tanks/master/assets/onlyObjects_retina_rotated.png
Hello how can you make it an finish output like a app ?
hi, thanks for all the tutorials you done for us. would you like to suggest how to read the gdscript api?
Thanks for your complete tutorial. I'd like a special way to move the tank: if for example the body is 90 degrees and I push the left key, the body smoothing with no movement turn until 270 degrees and then go to the left. The same if it is looking at left y I push the right button. In your tutorial right and left keys only rotate and forward and back are producing the movement. Thanks and sorry for my bad English
Tank you very much <3
Finally, a proper Godot tutorial. Good pace. Thanks for this.
I am rewatching this video again 🙂
Hello Sir, We are students in France, we have created an online platform dedicated to students
of the world, students are signing up on our site in order to follow courses, or to correspond with other students.
We tried to browse your videos youtube, we find that the content is clear and comprehensive.
So we decided to propose you to simply put your course in our platform.
To be done, we would need your official agreement.
Your courses on our platform will allow you to have many more views of course
and make your youtube chanel known
If you accept, we could just embed your youtube videos link .
Wishing you good reception, cordially
Our platform is in this adress :https://galatsii.com
Make a game with Tkinter
Why am I getting this ?? I did it as in the video step by step and this keeps appearing
Invalid set index 'wait_time' (on base: 'Timer') with value of type 'Nil'.
I was wondering if you could explain some things to those who are still new to Godot (me). Why did you use a dollar sign when referencing to the timer (named GunTimer)? Why did you add the if statement just to return nothing? What is the control function? Sorry to ask so much, I'm just trying to understand as much of this tutorial as possible <3
the player doesnt move smoothly it moves snappy and only moves whenever i tap right/left button not by long pressing it help
it says identifier not found: speed but I copied the script correctly?…any help?
Hello i can't see the sprites when i launch the game but i see them in the viewport … i don't understand why.
export signal
how did you learn to code like tht like steps should i take to get at your lvl
for mine there is the issue on $GunTimer.wait_time = gun_cooldown
I got: invalid set index 'wait_time' (on base: 'null instance') with value of type 'float'.
can someone help?
My tank stays in the upper left corner and cannot be moved with WASD. How can I change this?
hi, great tutorial, i had a problem whit mi code can you help me?
i put
export (float) var rotation_speed
export (float) var gun_cooldown
export (int) var health
var velocity = Vector2()
var can_shoot = true
var alive = true
func _ready():
$GunTimer.wait_time = gun_cooldown
but when i try to test the tank this menssage apper
invalid se index 'wait_time'(on base:null instance)with value of type null
and i put the var
export (float) var gun_cooldown
but still apper the message
Hello!!!! My tank is not moving, if you could take a look in my code iam going to appreciate!
this is the Tank.gd :
extends KinematicBody2D
signal health_changed
signal dead
export (PackedScene) var Bullet
export (int) var speed
export (float) var rotation_speed
export (float) var gun_cooldown
export (int) var health
var velocity = Vector2()
var can_shoot = true
var alive = true
func _ready():
$GunTimer.wait_time = gun_cooldown
func control(delta):
pass
func _physics_process(delta):
if not alive:
return
control(delta)
move_and_slide(velocity)
and now Player.gd :
extends "res://Tanks/Tank.gd"
func control(delta):
$Turret.look_at(get_global_mouse_position())
var rot_dir = 0
if Input.is_action_pressed('turn_right'):
rot_dir += 1
if Input.is_action_pressed('turn_left'):
rot_dir -= 1
rotation += rotation_speed * rot_dir * delta
velocity = Vector2()
if Input.is_action_pressed('forward'):
velocity = Vector2(speed, 0).rotated(rotation)
if Input.is_action_pressed('backward'):
velocity = Vector2(-speed/2, 0).rotated(rotation)
Watching this before I have Godot downloaded
Hi @KidsCanCode, and anyone else reading this comment, may someone explain to me in detail what "rotated(rotation)" does? I can understand Vector2(speed, 0) but I don't understand how it's working with the "rotated(rotation)".
at 8:51, when I select the area of the image it also takes the color of the background with the selected img. Help.
I don't know what I did but the tank does not move at run time. It only stands still but the turret does move with the mouse
Great Series! 👍
Are you using c++?
Why is only my turret moving and my tank isnt?
I am using Godot 2(long story) and everything else seems nice but the turret looks 90 degree offset to the current mouse position.plz help,nothing on google😭