Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

I wonder how many posts get to their third post. There must be a number of posts that's a kind of event horizon that's indicative of a long term commitment at some point right? It's kind of insane thinking that three weeks used to be a third of a quarter. Like that means I learned 1/3 of my biomechanics course at this point.

Anyway, back to this.

I worked mainly on making the skills activate this week. Initially I thought that it'd be super easy, barely an inconvenience as I just 'activated' a skill by instantiating a prefab that was a ball of light. I thought 'yeah great, done'.

But then I sat there thinking 'wait I want the light to ramp up and down when I turn it on and off so that it doesn't just pop into existence'. So I went back and wrote some coroutine scripts to make that work. So then when I 'activated' my skill it would fade slowly in then it would fade slowly out. Neat!

So I thought I was done with that. But then I tried activating the light skill when it was still active and I had TWO instantiated prefabs. This wasn't ideal. I had to put in a check in my Cast method in my LightSkill class to see if there was already a light active. If there was I needed to put in a way to 'rebrighten' the light if it was in the middle of fading out.

So that was like... about five times harder than I thought it would be at least. Since I'm doing all of this after wrok, just thinking how the code would work for this and then writing it took two and a half of my evenings... I ended up with this code.


Looking at this makes me kinda sad, since it legitimately took me about 5 solid hours to just reason my way here from 'wait, I can't just instantiate it'. But this is what the result of this looked like.

I also coloured the balls from last time.

Since this was done it wasn't too hard to throw in a dark skill. 

Which looks nice. I also made it so that the light and dark skills will destroy each other on instantiation if one is 'in the way'.

I also  made all the skills through and ISkill interface with a Cast() skill.

I actually just wrote a basic post on how to make these skills with reflection here if anyone was actually curious as to how to code with at least a small amount of architecture in mind.

I'll start on creating a lamp that I can turn on and off with these this week I think.