@@ -15,10 +15,10 @@ function M.create(collision_hashes)
15
15
ground_contact = false ,
16
16
wall_contact = false ,
17
17
jumping = false ,
18
+ double_jumping = false ,
18
19
}
19
20
20
21
local correction = vmath .vector3 ()
21
- local double_jumping = false
22
22
23
23
local function jumping_up ()
24
24
return (instance .velocity .y > 0 and instance .gravity < 0 ) or (instance .velocity .y < 0 and instance .gravity > 0 )
@@ -48,9 +48,10 @@ function M.create(collision_hashes)
48
48
instance .velocity .y = power * 0.75
49
49
instance .velocity .x = instance .wall_contact .x * power * 0.35
50
50
instance .jumping = true
51
- elseif allow_double_jump and jumping_up () and not double_jumping then
51
+ instance .wall_jumping = true
52
+ elseif allow_double_jump and jumping_up () and not instance .double_jumping then
52
53
instance .velocity .y = instance .velocity .y + power
53
- double_jumping = true
54
+ instance . double_jumping = true
54
55
end
55
56
end
56
57
@@ -79,11 +80,12 @@ function M.create(collision_hashes)
79
80
if proj < 0 then
80
81
instance .velocity = instance .velocity - proj * message .normal
81
82
end
82
- instance .wall_contact = message .normal .x ~= 0 and message .normal or instance .wall_contact
83
- instance .ground_contact = instance . ground_contact or message .normal .y ~= 0
83
+ instance .wall_contact = math.abs ( message .normal .x ) > 0.8 and message .normal or instance .wall_contact
84
+ instance .ground_contact = message .normal .y ~= 0 and message . normal or instance . ground_contact
84
85
if message .normal .y ~= 0 then
85
86
instance .jumping = false
86
- double_jumping = false
87
+ instance .double_jumping = false
88
+ instance .wall_jumping = false
87
89
end
88
90
end
89
91
end
0 commit comments