Thursday, March 31, 2016

Walls and Goals Inherit some Class

New build is up here!

Whoa, a Sunday Is The Deadline post before Friday? Weird!

Well, I'm visiting some friends for the weekend, so this is the only time I have to post. And, sorry to say, even though a lot was shifted around behind the scenes this week, nothing should appear different in this build from last week's build. (If there is something different, then I've messed up!)

A few weeks ago I set up my solution for timers and switches, which used a separate script called "TimedBlink" which implemented the "timable" interface. Timer classes looked for objects with timable components to switch them off or on at set intervals. I realized this was awkward as soon as I went to implement switches. (Switches would need to look for timable object too, and then turn them off).

This week, I ripped the functionality for things to turn themselves on and off (which involves managing particle effects and sound effects) out of the timable interface and put that into an interface called activatableAndDeactivatable (I really hope I think of a better name for that soon). This interface has an Activate method, a Deactivate method, and a Flip method, which will activate the object if it is inactive, and vice versa.

Furthermore, I created a script for default walls (called DefaultWall, go figure) which implements the activatableAndDeactivatable interface. I then made sure that switches and timers still functioned for default walls. Right after that, I had all other wall types inherit from the DefaultWall class.

I did a similar job with goals. The base goal script now implements that obnoxiously named interface, and enemies and linked goal nodes inherit from it. Well, linked goal nodes do. I'll have enemies inheriting from the Goal script next week. And then almost all relevant objects will be able to be switched on and off in a suitably ambiguous fashion!

Charge-up sound effect, as always, is by Javier Zumer. I'm using it under this license. I have modified it.

No comments:

Post a Comment