Skip to main content
Rephrased question
Source Link

Have you thought about adding negative velocity and using a ternary statement to decide what to add?

if(keys.up != keys.down) {
  acceleration.add(0, keys.up ? 0.001 : -0.001);
  velocity.add(acceleration);
  location.add(velocity);
}

EDIT: What platform are you using? I've never seen a vector class that couldn't go negative.

Have you thought about adding negative velocity and using a ternary statement to decide what to add?

if(keys.up != keys.down) {
  acceleration.add(0, keys.up ? 0.001 : -0.001);
  velocity.add(acceleration);
  location.add(velocity);
}

EDIT: What platform are you using?

Have you thought about adding negative velocity and using a ternary statement to decide what to add?

if(keys.up != keys.down) {
  acceleration.add(0, keys.up ? 0.001 : -0.001);
  velocity.add(acceleration);
  location.add(velocity);
}

EDIT: What platform are you using? I've never seen a vector class that couldn't go negative.

added 161 characters in body
Source Link

Have you thought about adding negative velocity and using a ternary statement to decide what to add?

if(keys.up != keys.down) {
  acceleration.add(0, keys.up ? 0.001 : -0.001);
  velocity.add(acceleration);
  location.add(velocity);
}

EDIT: What platform are you using?

Have you thought about adding negative velocity and using a ternary statement to decide what to add?

Have you thought about adding negative velocity and using a ternary statement to decide what to add?

if(keys.up != keys.down) {
  acceleration.add(0, keys.up ? 0.001 : -0.001);
  velocity.add(acceleration);
  location.add(velocity);
}

EDIT: What platform are you using?

Source Link

Have you thought about adding negative velocity and using a ternary statement to decide what to add?