ok here is the deal. in my footer, i would like it so that the ball never goes under 1, but that would be a lot of “if” statements to right it :crazy:. so i was wondering what my options would be. this is the current code:
if (speed == 0){
speed = 1;
}
if (speed == .01) {
speed = 1;
}
if (speed == .02) {
speed = 1;
}
if (speed == .03) {
speed = 1;
}
if (speed == .04) {
speed = 1;
}
if (speed == .05) {
speed = 1;
}
if (speed == .06) {
speed = 1;
}
if (speed == .07) {
speed = 1;
}
if (speed == .08) {
speed = 1;
}
if (speed == .09) {
speed = 1;
}
if (speed == .1) {
speed = 1;
}
if (speed == .2) {
speed = 1;
}
if (speed == .2) {
speed = 1;
}
if (speed == .3) {
speed = 1;
}
if (speed == .4) {
speed = 1;
}
}
couldnt i use like:
if(speed == speed<1){
speed = 1;
}
i will try this, but do you think this will work? if not what can i do?
i will try this, but do you think this will work? if not what can i do? **
you were close. its just
if(speed<1){
speed = 1;
}
you can also use
speed = Math.max(speed, 1);