Devlog Day 5

Vim and moving sprites in Godot
vim
gamedev
theprimagean
Author

Evan Lesmez

Published

August 4, 2024

After watching some ThePrimegean vids, I was inspired to get back into using NeoVim as my primary text editor.
I had the “Practical Vim” book lying around so I picked it back up again and started practicing.

Some Vim notes I took today:
Ex Commands are intended for longer range where as normal commands are more local to a region of the document being edited.
Capital V is a full linve visual select rather than lower v.
:t or :co is shortand for copy.
:m is shorthand for move :$ is end of file.
:1 is first line
:'<,'> is current visual selection.
:{range} normal . runs the prev normal mode command on the range. this builds off that . is the key to repeat the last normal mode command. :%: repeats the last EX command

Back to GDQuest Godot:
From the godot-vim repo I downloaded the zip and enabled the plugin for Vim bindings in Godot editor.
Some of the bindings are missing like execute mode and Ctrl+[ to exit insert mode unfortunately.
In Godot, position of objects is manipulated by the position attribute of the node.
You can add or subtract 2D vectors to change the position relative to the prev position in the _process method of the node.
Vector2D comes with an angle method that gives the angle of the vector probably in relation to to the positive direction of the x axis.
Using this angle, you can manipulate the rotation attribute of a node to keep the direction of the object facing the direction of velocity.
Helpful for sprites like this ship.