Multiple switches vs if-else conditions

Started by
10 comments, last by Drenith Wraithis 11 years, 10 months ago
Hmmm...I think I'm actually doing what you're talking about with my vitalBar class. I have a single vitalBar class, when you target an "enemy" it enables the vitalbar which grabs the enemyHealth script attached to the targeted "enemy" and populates the vitalBar with it's min, max, and current health.

So all monsters share the same vitalbar, it just loads the health from the active target.

I guess on each NPC I can add the dialogue (a long string or reference to wherever I store the text) for that npc and pass it to the enabled menu when the player enters the collider. Then each npc and it's dialogue is independent of one another........which makes sense.....thanks a lot.
Advertisement

I'm a student learning with the hopes of making something I can put on the app store. My school uses Java but I like C#. Even my crappy C# runs faster than the best OOP javascript I ever encountered with html5.

Tad off topic, but I'd like to point out that Java and Javascript are actually not the same at all. Javascript is a completely seperate creation developed by a different group that just "borrowed" the name. Actual java will perform at about the same as c# (and is very very similar to c#, it's believed that microsoft "borrowed" the syntax in developing c# to make it easier to convert java developers), javascript in a browser will (as you've noticed) be much slower in general and is a decent bit different with it's prototypal inheritance instead of classes.

http://www.java.com/en/download/faq/java_javascript.xml

This topic is closed to new replies.

Advertisement