-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtwoMice.gd
53 lines (35 loc) · 862 Bytes
/
twoMice.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
extends KinematicBody2D
var padPos
var playerPos
var headLPos
var headRPos
var headLch = false
var headL = null
var headRch = false
var headR = null
func _ready():
set_fixed_process(true)
headL = get_node("heads/headLsprite")
headR = get_node("heads/headRsprite")
func _fixed_process(delta):
padPos = get_parent().get_node("pad").get_pos()
playerPos = get_parent().get_node("mouse").get_pos()
headLPos = headL.get_global_pos()
headRPos = headR.get_global_pos()
move_to(Vector2(padPos.x,732))
headL.look_at(playerPos)
headR.look_at(playerPos)
if headLPos.x > playerPos.x:
if headLch == false:
headL.set_frame(1)
headLch = true
else:
headLch = false
headL.set_frame(0)
if headRPos.x > playerPos.x:
if headRch == false:
headR.set_frame(1)
headRch = true
else:
headRch = false
headR.set_frame(0)