City Defenders TD
- 8 Devlogs
- 54 Total hours
Tower Defense Game About Defending Medieval Cities
Tower Defense Game About Defending Medieval Cities
Quite a bit of progress!
Lots of progress again! This one was slightly more in the background, as I started a little bit of housekeeping:
It took a while, but there have been some pretty big improvements.
self.scene.game.screen.width which isn’t very pretty. It’ll do, though. I track a variable storing the turret to be placed (None if it’s not in that state) and a variable that stores whether it can be placed. I check for collisions between the path tiles (I knew it would be useful!) and the sprite to check if it can be placed. I also modified the draw function of the turret to make it red or green depending on it.Overall, some very good progress, even if it’s not 100% visible!
I decided to just write the GUI from scratch. This is kind of uncharted territory for me. I tried using pygame_gui but it felt really restrictive and the use of a json file for customization is absurd to me. I made a basic element abstract class so that all elements must have an update and draw method. I then made a button class and a container class. All elements have an ID, and when a button is clicked it sends out a pygame event, which is a feature I did like from pygame_gui. I think I will end up eventually making an UI manager class, as handling the state within the scene is getting clunky and weird.
I’ve probably progressed more in these ~6.25 hours than the rest of the project combined.
r key will toggle between drawing the areas and not.Quite a lot of progress!
I decided to give up on the isometry because I wasn’t really getting anything done. I have gone back to using a 2d map instead.|
I know this was kind of a setback, but real progress can be made now!
Turns out, rendering isometric grids is pretty hard! I followed a tutorial by DaFluffyPotato on isometric rendering which let me understand the drawing part, but there are going to be some issues with the grid system in the future. I had an issue in which the grid wouldn’t draw half of itself, and it was because it was drawing everything to the right of the top tile outside it. I got it to work by multiplying the grid width by 2 and then adding an offset, but it’s kind of a band-aid and I want to research more into how to actually solve it. I did actually draw the sprites myself, though, and I have a grass block that looks really nice but that’ll be for later.
I’ve been working for a while, mostly on backwards-facing stuff about the general project structure:
The next thing to work on is to allow the turret to rotate as if it was on top of the ship, and to handle ship movement, having it rotate to face where it is moving.
The following image is actually 2 different sprites: the turret (green) and the ship (below). It draws them by blitting the turret on top of the ship sprite.