Published On May 25, 2024
In this video we'll look at an application of the Strategy Pattern to game dev in Godot 4.
The Strategy Pattern is a programming pattern useful for switching how an algorithm works at runtime. We use it a little differently here to apply a variable set of upgrades to a projectile fired by the player. A very closely related term is "polymorphism" if you're familiar with that.
Project Link:
GDScript - https://github.com/Bitlytic/Strategy-...
C# - https://github.com/Bitlytic/Strategy-...
Discord - / discord
Resources:
Arks Dinos - https://arks.itch.io/dino-characters
Kenney's 1-Bit Pack - https://kenney.nl/assets/1-bit-pack
RGS_Dev's Tileset - https://rgsdev.itch.io/free-cc0-top-d...
Outro Music - • [Ludum Dare 55] Aphantasia - Forest
Timestamps:
00:00 Intro
00:12 The Strategy Pattern
00:17 Simple list example
00:50 Number filter class
02:17 But why use it?
02:34 Applying upgrades
02:55 GitHub and project info
03:34 Godot time
03:51 Base upgrade class
04:19 Player upgrade usage
04:38 Upgrades as resources
05:10 Custom upgrade
05:59 Possibilty for extension
06:11 Semi-important announcement (You are free to leave)