-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForm1.vb
More file actions
173 lines (166 loc) · 5.96 KB
/
Form1.vb
File metadata and controls
173 lines (166 loc) · 5.96 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Math
Public Class DoggoForm
Dim MoveRight As Boolean = False
Dim MoveLeft As Boolean = False
Dim StayRight As Boolean = True
Dim StayLeft As Boolean = False
Dim JumpLeft As Boolean = False
Dim JumpRight As Boolean = False
Dim Counter As Integer = 0
Dim sinval As Double
Private Sub DoggoForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Location = New Point(0 = Me.Width, My.Computer.Screen.WorkingArea.Bottom - Me.Height + 19)
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim x As Integer = Me.Location.X
Dim y As Integer = Me.Location.Y
'
If MoveRight = True Then
y = My.Computer.Screen.WorkingArea.Bottom - Me.Height + 19
If Me.Location.X <= My.Computer.Screen.WorkingArea.Width Then
x = x + 2
Me.Location = New Point(x, y)
Else
Me.Location = New Point(0 - Me.Width, y)
End If
ElseIf MoveLeft = True Then
y = My.Computer.Screen.WorkingArea.Bottom - Me.Height + 19
If Me.Location.X >= 1 - Me.Width Then
x = x - 2
Me.Location = New Point(x, y)
Else
Me.Location = New Point(My.Computer.Screen.WorkingArea.Width - 1, y)
End If
End If
'
If StayLeft = True Or StayRight = True Then
y = My.Computer.Screen.WorkingArea.Bottom - Me.Height + 19
If Me.Location.X >= 1 - Me.Width Then
x = x
Me.Location = New Point(x, y)
Else
Me.Location = New Point(My.Computer.Screen.WorkingArea.Width - 1, y)
End If
End If
'
If JumpLeft = True Then
x = x - 3
Counter = Counter + 1
sinval = Sin((Counter * PI) / 180)
y = (My.Computer.Screen.WorkingArea.Bottom - Me.Height + 15) - Int(sinval * 150)
Me.Location = New Point(x, y)
If Counter > 180 Then
JumpLeft = False
MoveLeft = True
Dog.Image = My.Resources.Dog_Walk
End If
End If
If JumpRight = True Then
x = x + 3
Counter = Counter + 1
sinval = Sin((Counter * PI) / 180)
y = (My.Computer.Screen.WorkingArea.Bottom - Me.Height + 15) - Int(sinval * 150)
Me.Location = New Point(x, y)
If Counter > 180 Then
JumpRight = False
MoveRight = True
Dog.Image = My.Resources.Dog_Walk_2
End If
End If
End Sub
Private Sub PictureBox1_Click_1(sender As Object, e As EventArgs) Handles Dog.MouseHover
'Form2.Show()
'Will delete below things for other peeps
If MoveLeft = True Or StayLeft = True Then
JumpLeft = True
Dog.Image = My.Resources.Dog_Jump
MoveRight = False
MoveLeft = False
StayRight = False
StayLeft = False
JumpRight = False
Counter = 0
ElseIf MoveRight = True Or StayRight = True Then
JumpRight = True
Dog.Image = My.Resources.Dog_Jump_2
MoveRight = False
MoveLeft = False
StayLeft = False
StayRight = False
JumpLeft = False
Counter = 0
End If
End Sub
Private Sub Yes(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Left Then
If JumpLeft = False And JumpRight = False Then
Dog.Image = My.Resources.Dog_Walk
MoveRight = False
MoveLeft = True
StayRight = False
StayLeft = False
JumpRight = False
JumpLeft = False
End If
End If
If e.KeyCode = Keys.Right Then
If JumpLeft = False And JumpRight = False Then
Dog.Image = My.Resources.Dog_Walk_2
MoveLeft = False
MoveRight = True
StayRight = False
StayLeft = False
JumpRight = False
JumpLeft = False
End If
End If
If e.KeyCode = Keys.Down Then
If JumpLeft Or JumpRight = False Then
If MoveLeft = True Then
StayLeft = True
Dog.Image = My.Resources.Dog_Idle
MoveRight = False
MoveLeft = False
StayRight = False
JumpRight = False
JumpLeft = False
ElseIf MoveRight = True Then
StayRight = True
Dog.Image = My.Resources.Dog_Idle_2
MoveRight = False
MoveLeft = False
StayLeft = False
JumpRight = False
JumpLeft = False
End If
End If
End If
If e.KeyCode = Keys.Up Then
If MoveLeft = True Or StayLeft = True Then
JumpLeft = True
Dog.Image = My.Resources.Dog_Jump
MoveRight = False
MoveLeft = False
StayRight = False
StayLeft = False
JumpRight = False
Counter = 0
ElseIf MoveRight = True Or StayRight = True Then
JumpRight = True
Dog.Image = My.Resources.Dog_Jump_2
MoveRight = False
MoveLeft = False
StayLeft = False
StayRight = False
JumpLeft = False
Counter = 0
End If
End If
If e.KeyCode = Keys.Escape Then
End
End If
End Sub
End Class