I hope I understood what ringbuffer means

Took this on as a challenge and I got it working! Yay, it’s not that many lines of codes but took me ages and a lot of errors to eventually get right, had to use pen and paper and weird diagrams to sort it out in my head. It was a great exercise to understand Queues properly. So I used a queue to keep track of the number of towers spawned in the world, and when it reaches the max number determined by the “spawner”, it simply takes the oldest tower (had to use Peek to get there) and just repositioning it into the new location, as oppose to destroying an old one and instantiate another one, hope this is what ringbuffer is about…! (I shall find out as I progress towards the next lessons)


(just realised I had music on in the background while recording with OBS…woops)

Code got super messy in the process of the bodging the challenge to work though, I mean, look at this lol

spawner.spawnQueue.Enqueue(spawner.spawnQueue.Dequeue());

Time to do some refactoring!

2 Likes

Your game looks amazing, especially first three seconds with this music :100:

1 Like

Privacy & Terms