1 | package g0803.bindingofshiba.model.game.elements; | |
2 | ||
3 | import g0803.bindingofshiba.math.Vec2D; | |
4 | ||
5 | public class MoveableElement extends Element { | |
6 | ||
7 | private Vec2D velocity = Vec2D.zero(); | |
8 | private Vec2D acceleration = Vec2D.zero(); | |
9 | ||
10 | public MoveableElement(Vec2D position) { | |
11 | super(position); | |
12 | } | |
13 | ||
14 | public Vec2D getVelocity() { | |
15 |
1
1. getVelocity : replaced return value with null for g0803/bindingofshiba/model/game/elements/MoveableElement::getVelocity → KILLED |
return velocity; |
16 | } | |
17 | ||
18 | public Vec2D getAcceleration() { | |
19 |
1
1. getAcceleration : replaced return value with null for g0803/bindingofshiba/model/game/elements/MoveableElement::getAcceleration → KILLED |
return acceleration; |
20 | } | |
21 | ||
22 | public void setVelocity(Vec2D velocity) { | |
23 | this.velocity = velocity; | |
24 | } | |
25 | ||
26 | public void setAcceleration(Vec2D acceleration) { | |
27 | this.acceleration = acceleration; | |
28 | } | |
29 | ||
30 | public Vec2D getNextVelocity(double dt) { | |
31 |
1
1. getNextVelocity : replaced return value with null for g0803/bindingofshiba/model/game/elements/MoveableElement::getNextVelocity → KILLED |
return this.velocity.add(this.acceleration.scale(dt)); |
32 | } | |
33 | ||
34 | public Vec2D getNextPosition(double dt) { | |
35 |
1
1. getNextPosition : replaced return value with null for g0803/bindingofshiba/model/game/elements/MoveableElement::getNextPosition → KILLED |
return this.getPosition().add(getNextVelocity(dt).scale(dt)); |
36 | } | |
37 | ||
38 | public void move(double dt) { | |
39 | Vec2D nextVelocity = getNextVelocity(dt); | |
40 | Vec2D nextPosition = getNextPosition(dt); | |
41 | ||
42 |
1
1. move : removed call to g0803/bindingofshiba/model/game/elements/MoveableElement::setVelocity → KILLED |
this.setVelocity(nextVelocity); |
43 |
1
1. move : removed call to g0803/bindingofshiba/model/game/elements/MoveableElement::setPosition → KILLED |
this.setPosition(nextPosition); |
44 | } | |
45 | } | |
Mutations | ||
15 |
1.1 |
|
19 |
1.1 |
|
31 |
1.1 |
|
35 |
1.1 |
|
42 |
1.1 |
|
43 |
1.1 |