View Single Post
EvilMike EvilMike's Avatar

JCF Member

Joined: Jun 2001

Posts: 3,478

EvilMike is OFF DA CHARTEvilMike is OFF DA CHARTEvilMike is OFF DA CHARTEvilMike is OFF DA CHART

Jun 30, 2009, 01:07 PM
EvilMike is offline
The OOP approach is definitely the best one... it does seem more complicated at first, but in the end it makes the most sense, and the code is a lot more readable too.

Though personally I'd write that class so it allows you to define a range of tiles and not just an individual tiles, because that way you could have it take any shape (a single tile, a rectangle, or a line). Would need 2 sets of x,y coordinates for that (instead of just 1), but it would be more flexible, and therefore more usable. By not just limiting it to a single tile, you can have it so when the player passes a certain mark (say, enters a room) the music changes. Otherwise, with the example above, you'd need to spam a whole bunch of MusicTriggers, one for each tile. This might make sense to people who are thinking in a JCS mindset (where you often have to spam tiles like this), but in a script there's really no point in doing that.

I'm too lazy to bother rewriting it as an example but you get the idea!