arggg "What's Next" display. I'm not gonna let it beat me
by GxG6(Mark-Anthony) · in Torque X 2D · 08/03/2010 (2:06 am) · 2 replies
Hey guys i've been trying to tackle this for the longest time, and is the thing thats currently jamming my development up. I'm no were near good at programming in my own opinion and this is all a learn experience which I will not quit at. anyway I like to thank the people who have been patient and friendly with me when it comes to my forum posts (Henry and Pino to name a few).
ok on to the real issue.
I created a code that when the player presses the fire button a random item is shot.
there are only 3 possible items to shoot off currently. anway the code is similar to this:
ok thats working well now I want to display on screen the next item that you will be able to use. (its only fair to the player that they have a heads up of what they are shooting right?)
So after many attempts here is my lastest: I added a blank screen object to the scene. (i am thinkin ok everytime a item is chosen i'll switch the sceneobject with another one) and heres what i did.(note i made a seperate component for the blank scene object)
well it looked fine to me, so i added the scenes that it would reference to in torque and then i ran it and Hello I met my dear arch rival the "NullReference" error.............UGH
so back to the drawing board but i decided to ask for help here. I got everything else for my game working pretty good the timers, basic gui, even the level loading but when it comes to this which is probably simple, I get stuck o_0.
any insight will help. I will not give up i know all these issues i'm running into will help me learn torque
ok on to the real issue.
I created a code that when the player presses the fire button a random item is shot.
there are only 3 possible items to shoot off currently. anway the code is similar to this:
switch (pbit)
{
case 0:
DrillB = _drillTemp.Clone() as T2DSceneObject;
break;
case 1:
DrillB = _drilltemp1.Clone() as T2DSceneObject;
break;
case 2:
DrillB = _drilltemp2.Clone() as T2DSceneObject;
break;
}
.....
if (move.Buttons[0].Pushed && (_timesincelastdrill > _drilldelay) && (DrillB != null))
{
T2DSceneObject drillbit = DrillB.Clone() as T2DSceneObject;
......ok thats working well now I want to display on screen the next item that you will be able to use. (its only fair to the player that they have a heads up of what they are shooting right?)
So after many attempts here is my lastest: I added a blank screen object to the scene. (i am thinkin ok everytime a item is chosen i'll switch the sceneobject with another one) and heres what i did.(note i made a seperate component for the blank scene object)
case 0:
Loadedbit = _drillbit1.Clone() as T2DSceneObject;
Changethingy DB1 = Owner.Components.FindComponent<Changethingy>();
DB1.Default_Image = DB1.Bit_Type_1 as T2DSceneObject;
break;
case 1:
Loadedbit = _drillbit2.Clone() as T2DSceneObject;
Changethingy DB2 = Owner.Components.FindComponent<Changethingy>();
DB2.Default_Image = DB2.Bit_Type_2 as T2DSceneObject;
break;
case 2:
Loadedbit = _drillbit3.Clone() as T2DSceneObject;
Changethingy DB3 = Owner.Components.FindComponent<Changethingy>();
DB3.Default_Image = DB3.Bit_Type_3 as T2DSceneObject;
break;well it looked fine to me, so i added the scenes that it would reference to in torque and then i ran it and Hello I met my dear arch rival the "NullReference" error.............UGH
so back to the drawing board but i decided to ask for help here. I got everything else for my game working pretty good the timers, basic gui, even the level loading but when it comes to this which is probably simple, I get stuck o_0.
any insight will help. I will not give up i know all these issues i'm running into will help me learn torque
About the author
Current Graphic Designer, Musician, Pawnbroker,Game Developer.
#2
08/03/2010 (9:50 pm)
I figured i was going about it the wrong way :/ i'll send you an email thank you again
Associate Giuseppe De Francesco
DFT Games Ltd
looking at your code there are so many things that don't look right to me that it's quite difficult to me not knowing the rest of the code tell you how to write it the proper way.
The best solution I see here is that you send me (pino AT dftgames DOT com) your .cs file(s) and I'll go through that making the needed changes and adding comments to explain the reason for each change, then I'll send it back to you. Does this work for you?
Cheers,
Pino