dont use math function thats not up yet
This commit is contained in:
parent
0cf0dab974
commit
ed80a587ad
1 changed files with 13 additions and 1 deletions
|
|
@ -32,7 +32,7 @@ class Game is Ready {
|
||||||
var t = delta * 10
|
var t = delta * 10
|
||||||
pos = [Math.lerp(_prev_pos.x, pos.x, t), Math.lerp(_prev_pos.y, pos.y, t)]
|
pos = [Math.lerp(_prev_pos.x, pos.x, t), Math.lerp(_prev_pos.y, pos.y, t)]
|
||||||
if(Math.dist2D(pos, _prev_pos) > 0.1){
|
if(Math.dist2D(pos, _prev_pos) > 0.1){
|
||||||
var angle = Math.angle2D(_prev_pos, pos)
|
var angle = angle2D(_prev_pos, pos)
|
||||||
Transform.set_angle2D(_blade, angle)
|
Transform.set_angle2D(_blade, angle)
|
||||||
_prev_pos = pos
|
_prev_pos = pos
|
||||||
}
|
}
|
||||||
|
|
@ -49,6 +49,18 @@ class Game is Ready {
|
||||||
//System.print(1/delta)
|
//System.print(1/delta)
|
||||||
} //tick
|
} //tick
|
||||||
|
|
||||||
|
//temp stopgap until its in `Math`
|
||||||
|
static angle2D(from: Vec, to: Vec): Num{
|
||||||
|
return angle2D(from.x, from.y, to.x, to.y)
|
||||||
|
}
|
||||||
|
|
||||||
|
static angle2D(from_x: Num, from_y: Num, to_x: Num, to_y: Num): Num{
|
||||||
|
var diff_x = to_x - from_x
|
||||||
|
var diff_y = to_y - from_y
|
||||||
|
var angle = degrees(atan2(diff_y, diff_x))
|
||||||
|
return angle
|
||||||
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
|
|
||||||
System.print("unready!")
|
System.print("unready!")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue