Game Development Community

Advanced 3dgpai1: chapter 10

by Nathan · in Torque Game Engine · 04/10/2006 (7:47 am) · 4 replies

I'm trying to get the hit locations to work(pg. 284), but when I add the code to Armor::Damage when I go in the game and shoot something no damage is given?

#1
04/10/2006 (12:22 pm)
Something weird is happening. I have this code:

echo("REGION: " @%region);
	switch(%region)
	{
		case "head":
		echo("case = head");
			%damage = %damage * 2;
		case "torso":
		echo("case = torso");
			%damage = %damage;
		case "legs":
		echo("case = legs");
			%damage = %damage / 2;
	}

now when I shoot kork in-game, I get "REGION: legs" which is fine but below that I get "case = head"? So for some reason case head is being called all the time?
#2
04/10/2006 (12:58 pm)
Never mind, I finally figured it out...
#3
04/10/2006 (1:02 pm)
I'm not sure but you might need to use switch$ instead of switch
#4
04/10/2006 (1:15 pm)
Yes, that was the problem. I was reading from the book and thought it was a typo.