This site requires JavaScript, please enable it in your browser!
Greenfoot back
Roshan123
Roshan123 wrote ...

2020/5/24

plz help me

Roshan123 Roshan123

2020/5/24

#
i am having a problem and i am not able to make you understand what problem am i having .plz try to understand
if(Greenfoot.isKeyDown("p"+"e"))
{
    move(4);
}
i want if both the keys are pressed together than a output will be give by greenfoot.but its not working . plz tell me how will i fix it
danpost danpost

2020/5/24

#
You want to ask about two distinct conditions such that if BOTH are satisfied, then execute some specific code. That is a logical AND operation (if condition (a) AND if condition (b) ...:
if (Greenfoot.isKeyDown("p") && Greenfoot.isKeyDown("e"))
The "&&" is the logical AND operator and "||" is the logical OR operator.
You need to login to post a reply.