-
Notifications
You must be signed in to change notification settings - Fork 1
/
smith.bas
116 lines (88 loc) · 2.47 KB
/
smith.bas
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
smith_current_action = 0
slap = -1
smith_steps = 0
smith_Jump_Height = 0
smith_Jump_Force = 0
smith_move_speed = 0
smith_move_distance = 0
SMITH_ACTION_STAND_LEFT = 0
SMITH_ACTION_WALK_LEFT = 1
SMITH_ACTION_SMACK_LEFT = 2
SMITH_ACTION_JUMP_LEFT = 3
SMITH_ACTION_STAND_RIGHT = 4
SMITH_ACTION_WALK_RIGHT = 5
SMITH_ACTION_SMACK_RIGHT = 6
SMITH_ACTION_JUMP_RIGHT = 7
Sub smith_init()
smith = GetActorID("smith")
slap = GetActorID("slap")
Actor_Physics_State[smith] = PHYSICS_STATE_FALL
Actor_Weight[smith] = 3.5
Actor_Physics[smith] = True
smith_Jump_Height = 40
smith_Jump_Force = 3.5
smith_move_speed = 2
End Sub
Sub Smith_Set_Animation()
Select Case smith_current_action
Case SMITH_ACTION_STAND_LEFT
Actor_SetAnimationByName(smith, "Slap_left")
Actor_SetAnimationByName(slap, "Slap_left")
Actor_SetAnimationFrame(slap, 0)
Actor_SetPosition(slap, Actor_X[smith], Actor_Y[smith])
Actor_SyncAnimationTo(slap, smith)
Case SMITH_ACTION_WALK_LEFT
Actor_SetAnimationByName(smith, "Walk_left")
Actor_SetPosition(slap, 1033, 10)
Case SMITH_ACTION_STAND_RIGHT
Actor_SetAnimationByName(smith, "Slap_right")
Actor_SetAnimationByName(slap, "Slap_right")
Actor_SetAnimationFrame(slap, 0)
Actor_SetPosition(slap, Actor_X[smith], Actor_Y[smith])
Actor_SyncAnimationTo(slap, smith)
Case SMITH_ACTION_WALK_RIGHT
Actor_SetAnimationByName(smith, "Walk_right")
Actor_SetPosition(slap, 1033, 10)
End Select
End Sub
Sub smith_act()
If smith_stun Then
If Timer - smith_stun_time > 400 Then
smith_stun = false
Actor_SetEffect(smith, EFFECT_NONE, 0)
End If
End If
If Actor_AnimationEnded[smith] Then
smith_steps = smith_steps + 1
End If
smith_prev_action = smith_current_action
Select Case smith_current_action
Case SMITH_ACTION_STAND_LEFT
If smith_steps = 3 Then
smith_steps = 0
smith_current_action = SMITH_ACTION_WALK_LEFT
End If
Case SMITH_ACTION_WALK_LEFT
If smith_steps = 3 Then
smith_steps = 0
smith_current_action = SMITH_ACTION_STAND_RIGHT
Else
Actor_Move(smith, -smith_move_speed, 0)
End If
Case SMITH_ACTION_STAND_RIGHT
If smith_steps = 3 Then
smith_steps = 0
smith_current_action = SMITH_ACTION_WALK_RIGHT
End If
Case SMITH_ACTION_WALK_RIGHT
If smith_steps = 3 Then
smith_steps = 0
smith_current_action = SMITH_ACTION_STAND_LEFT
Else
Actor_Move(smith, smith_move_speed, 0)
End If
End Select
If smith_prev_action = smith_current_action Then
smith_set_animation()
End If
End Sub