View Single Post
Calling methods from different classes
Old
  (#1)
Zacker
Project Leader, Lead Level Designer, Waypointer
 
Status: Offline
Posts: 337
Join Date: Mar 2004
Location: Denmark
Default Calling methods from different classes - 12-06-2004

I have a method which can add a value to a variable. Calling it works fine, it adds the number to the variable and everything is good.
If the game calls the method from another class, then it looks like it adds it to a new variable.

Example:
Class1:
Add 50 to life. Life is now 50.
Add 50 more to life. Life is now 100.

Class2:
Add 20 to life. Life is now 20.
Add 50 to life. Life is now 70.

I dont understand how this can happen, as the variable only gets declared in the class with the aforemented method.

Edit:
The lang is Java.

Last edited by Zacker; 12-06-2004 at 21:29..
  
Reply With Quote