'Syntax error: expecting rightparen before not
I'm required to use ActionScript 3.0 in Adobe Animate for my latest project. It is really difficult for me to understand because I'm still. If any of you guys can help me solve this problem I am truly grateful to you.
here's where Adobe Animate said my coding is wrong
if (left && up !right && !down) {
mc_car.rotation = 315;
}
if (right && up !left && !down) {
mc_car.rotation = 45;
}
if (left && up !right && !up) {
mc_car.rotation = 225;
}
if (right && up !left && !up) {
mc_car.rotation = 135;
}
1084: Syntax error: expecting rightparen before not
Solution 1:[1]
You're missing the && between your two conditions in each if statement. And brackets grouping each condition's components.
Here's how your code should look.
if ((left && up) && (!right && !down)) {
mc_car.rotation = 315;
}
if ((right && up) && (!left && !down)) {
mc_car.rotation = 45;
}
if ((left && up) && (!right && !up)) {
mc_car.rotation = 225;
}
if ((right && up) && (!left && !up)) {
mc_car.rotation = 135;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |