Click here to Skip to main content
15,908,775 members
Home / Discussions / C#
   

C#

 
AnswerRe: Taking variables from other classes. Pin
N a v a n e e t h9-Jul-09 17:06
N a v a n e e t h9-Jul-09 17:06 
GeneralRe: Taking variables from other classes. Pin
nik1219-Jul-09 17:12
nik1219-Jul-09 17:12 
public class CharClasses
{
public int healthPoints = 0;
public int manaPoints = 0;
public int strength = 0;
public int dexterity = 0;
public int speed = 0;
public int intelligence = 0;

public CharClasses (string characterClass)
{
if (characterClass == "Warrior")
{
healthPoints = 100;
manaPoints = 10;
strength = 10;
dexterity = 5;
speed = 3;
intelligence = 0;
}

if (characterClass == "Archer")
{
healthPoints = 75;
manaPoints = 10;
strength = 3;
dexterity = 10;
speed = 5;
intelligence = 0;
}

if (characterClass == "Assassin")
{
healthPoints = 75;
manaPoints = 10;
strength = 5;
dexterity = 3;
speed = 10;
intelligence = 0;
}

if (characterClass == "Mage")
{
healthPoints = 50;
manaPoints = 50;
strength = 0;
dexterity = 5;
speed = 3;
intelligence = 10;
}
}
}

public class Leveling
{
public int level = 1;
public int experience = 0;

public Leveling()
{


if (experience == ((experience + 100) * 1.5))
{
level++;
}
}
}

I'm trying to take the constructor named "characterClass" from the class CharClasses and use it in the class Leveling.

CharClasses Class = new CharClasses(characterClass); I'm trying to make this code work but the characterClass part of it does not seem to work...
GeneralRe: Taking variables from other classes. Pin
N a v a n e e t h9-Jul-09 17:19
N a v a n e e t h9-Jul-09 17:19 
GeneralRe: Taking variables from other classes. Pin
nik1219-Jul-09 17:23
nik1219-Jul-09 17:23 
GeneralRe: Taking variables from other classes. Pin
N a v a n e e t h9-Jul-09 17:36
N a v a n e e t h9-Jul-09 17:36 
GeneralRe: Taking variables from other classes. Pin
Gary Stafford9-Jul-09 17:41
Gary Stafford9-Jul-09 17:41 
QuestionReading and storing variables from data files Pin
ReynaW12239-Jul-09 16:18
ReynaW12239-Jul-09 16:18 
AnswerRe: Reading and storing variables from data files Pin
N a v a n e e t h9-Jul-09 17:10
N a v a n e e t h9-Jul-09 17:10 
GeneralRe: Reading and storing variables from data files Pin
ReynaW122313-Jul-09 5:27
ReynaW122313-Jul-09 5:27 
QuestionProgressBar Pin
peishen889-Jul-09 16:12
peishen889-Jul-09 16:12 
AnswerRe: ProgressBar Pin
N a v a n e e t h9-Jul-09 17:13
N a v a n e e t h9-Jul-09 17:13 
GeneralRe: ProgressBar Pin
peishen889-Jul-09 17:29
peishen889-Jul-09 17:29 
GeneralRe: ProgressBar Pin
Mycroft Holmes9-Jul-09 19:52
professionalMycroft Holmes9-Jul-09 19:52 
Questionurgntz codez wanted. WinForms - show a usercontrol, docked, as Modal Pin
_Maxxx_9-Jul-09 13:56
professional_Maxxx_9-Jul-09 13:56 
AnswerRe: urgntz codez wanted. WinForms - show a usercontrol, docked, as Modal Pin
Mycroft Holmes9-Jul-09 14:06
professionalMycroft Holmes9-Jul-09 14:06 
GeneralRe: urgntz codez wanted. WinForms - show a usercontrol, docked, as Modal Pin
_Maxxx_9-Jul-09 15:51
professional_Maxxx_9-Jul-09 15:51 
GeneralRe: urgntz codez wanted. WinForms - show a usercontrol, docked, as Modal Pin
Mycroft Holmes9-Jul-09 19:50
professionalMycroft Holmes9-Jul-09 19:50 
QuestionIE automation Pin
yogesh_softworld1239-Jul-09 13:02
yogesh_softworld1239-Jul-09 13:02 
AnswerRe: IE automation Pin
schiebel-t9-Jul-09 21:14
schiebel-t9-Jul-09 21:14 
Question64bit fixed point timestamp to and from DateTime Pin
DaveyM699-Jul-09 11:32
professionalDaveyM699-Jul-09 11:32 
AnswerRe: 64bit fixed point timestamp to and from DateTime Pin
Luc Pattyn9-Jul-09 12:24
sitebuilderLuc Pattyn9-Jul-09 12:24 
GeneralRe: 64bit fixed point timestamp to and from DateTime Pin
DaveyM699-Jul-09 22:28
professionalDaveyM699-Jul-09 22:28 
AnswerRe: 64bit fixed point timestamp to and from DateTime Pin
Henry Minute9-Jul-09 12:29
Henry Minute9-Jul-09 12:29 
GeneralRe: 64bit fixed point timestamp to and from DateTime Pin
DaveyM699-Jul-09 22:20
professionalDaveyM699-Jul-09 22:20 
AnswerRe: 64bit fixed point timestamp to and from DateTime [modified] Pin
Luc Pattyn9-Jul-09 13:41
sitebuilderLuc Pattyn9-Jul-09 13:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.