-
Notifications
You must be signed in to change notification settings - Fork 6
/
HoppingLeft.q.yml
76 lines (56 loc) · 1.41 KB
/
HoppingLeft.q.yml
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
parent_classes:
- class: Wicked::Entities::MovementStrategies2D::Base
scope: public
init_with: ''
properties:
- name: entity
type: Wicked::Entities::Basic2D*
init_with: nullptr
constructor_arg: true
- name: jump_force
type: float
init_with: 5.0f
constructor_arg: true
getter: true
setter: true
- name: speed
type: float
init_with: 1.0f
constructor_arg: true
getter: true
setter: true
- name: landing_delay
type: float
init_with: 2.0f
constructor_arg: true
getter: true
setter: true
- name: timer
type: float
init_with: 0.0f
functions:
- name: update
override: true
guards: [ entity ]
body: |
if (entity->exists("on_ground"))
{
entity->get_velocity_ref().position.x = 0;
timer -= (1.0/60.0f);
if (timer <= 0)
{
timer += landing_delay;
entity->get_velocity_ref().position.x = 0;
entity->get_velocity_ref().position.y = -jump_force;
entity->remove("on_ground");
}
}
else if (!entity->exists("on_ground"))
{
entity->get_velocity_ref().position.x = -speed;
}
dependencies:
- symbol: Wicked::Entities::MovementStrategies2D::Base
headers: [ Wicked/Entities/MovementStrategies2D/Base.hpp ]
- symbol: Wicked::Entities::Basic2D
headers: [ Wicked/Entities/Basic2D.hpp ]