Hello. I'm sorry for my bad English. I have problem with my weapon_change function. It doesn't work. When i press space nothing happen. I can't understand why..
My code:
public void act()
{
moveAround();
Change_weapon(); // if i comment then it can shoot
if(standart_weapon == 1)
{
delay++;
if(delay > 30)
{
Shoot();
delay = 0;
}
}
else
{
Shoot();
}
//GetLevel = ((MyWorld)getWorld()).level;
}
public void Change_weapon()
{
if("1".equals(Greenfoot.getKey()))
{
machine_gun = 0;
bazzuka = 0;
standart_weapon = 1;
}
if("2".equals(Greenfoot.getKey()))
{
machine_gun = 1;
bazzuka = 0;
standart_weapon = 0;
}
if("3".equals(Greenfoot.getKey()))
{
machine_gun = 0;
bazzuka = 1;
standart_weapon = 0;
}
}
public void moveAround()
{
if(Greenfoot.isKeyDown("down"))
{
setLocation(getX(),getY()+5);
}
if(Greenfoot.isKeyDown("up"))
{
setLocation(getX(),getY()-5);
}
}