i am trying to make ship shoot bullet and laser..
this my code:
public readonly static TimeSpan delay = new TimeSpan(0, 0, 0, 0, 330);
private TimeSpan lastupdate1;
private TimeSpan lastupdate2;
// bullet
public Texture2D pelurutexture;
//laser
public Texture2D lasertexture;
public void control(GameTime GT)
{
if ((Keyboard.GetState().IsKeyDown(Keys.Space) || (Keyboard.GetState().IsKeyDown(Keys.RightShift))))
{
if (Keyboard.GetState().IsKeyDown(Keys.Space) && (lastupdate1 > delay))
{
flys[0].shoot();
lastupdate1 = TimeSpan.Zero;
}
else if (Keyboard.GetState().IsKeyDown(Keys.RightShift) && (lastupdate1 > delay))
{
flys[0].shoot2();
lastupdate1 = TimeSpan.Zero;
}
}
else if (Keyboard.GetState().IsKeyDown(Keys.Space) && (Keyboard.GetState().IsKeyDown(Keys.RightShift)&& (lastupdate1 > delay)))
{
flys[0].shoot();
flys[0].shoot2();
lastupdate1 = TimeSpan.Zero;
}
}
if i click space, it will shoot bullet, if i clik shift, it will shoot laser.. but i can not shot 2 kind like laser and bullet at same time..
if i click space and shift together, it only shoot bullet, how to make it can shoot together ya?
thx..
This post has been edited by modi123_1: 15 January 2012 - 11:18 AM
Reason for edit:: please use code tags

New Topic/Question
Reply



MultiQuote








|