What I want to do is create an object but it depends on the user input what kind of object will be created.
The following code doesn't work for me, please can you help me how to do this right?
I deleted all unnecessary code.
MP5 and UMP are extended types of a firearm type which is a extended class of a weapon type. The method update is declared in my weapon type.
Now when I try to compile this the compiler says: "Identifier 'MyGun' not found." Why? I declared it in my 'select Weap' part as global.
The following code doesn't work for me, please can you help me how to do this right?
Local P1:Player = New Player; Local UserSetup:Setup = New Setup; Local Weap:String = UserSetup.getWeap(); Select Weap Case "MP5" Global MyGun:MP5 = New MP5; Case "UMP" Global MyGun:MP5 = New UMP; EndSelect Repeat P1.Move(); MyGun.Update(P1.X, P1.Y); Until KeyHit(KEY_ESCAPE)
I deleted all unnecessary code.
MP5 and UMP are extended types of a firearm type which is a extended class of a weapon type. The method update is declared in my weapon type.
Now when I try to compile this the compiler says: "Identifier 'MyGun' not found." Why? I declared it in my 'select Weap' part as global.