Space shooter help

Hey guys,

My problem is that I want to swap the players bullets upon pressing ‘x’. I have implemented senoculars keyobject class and followed a tutorial from asgamers.

this is the code…

**public function loop(e:Event) : void
{
//keypresses
if (key.isDown(88) && bulletchoice)
{
bulletchoice= false;
}
if (key.isDown(88) && (bulletchoice=false))
{
bulletchoice=true;
}

**starting off with this above… these just define some variables …

**if (key.isDown(Keyboard.SPACE))
fireBullet();

**I then tell it to activate fire bullet function when i press space…

**
" private function fireBullet() : void
{
//if canFire is true, fire a bullet
//set canFire to false and start our timer
//else do nothing.
if (canFire && bulletchoice)
{
stageRef.addChild(new LaserBlue(stageRef, x + vx, y - 10));
canFire = false;
fireTimer.start();
}
if (canFire && bulletchoice=false)
{
stageRef.addChild(new LaserRed(stageRef, x + vx, y - 10));
canFire = false;
fireTimer.start();
}

}"

**I then told it to fire either one of the lasers, each time it checks whether bullet choice is false or true and that determines what bullet is fired…

It HAD an error:

C:\Users\Comp\Desktop\flash game\com\asgamer\basics1\Ship.as, Line 134 1050: Cannot assign to a non-reference value.

Lol solved now, changed to == instead of =… I read up on it and understand it now :stuck_out_tongue:

the line it refers to is:
**if (canFire && bulletchoice=false)

**I know its to do with bulletchoice but… I dont kno why

PLEASE HELP

its much appreciated. Thanks. =)=)