-
Notifications
You must be signed in to change notification settings - Fork 1
/
magic orange
203 lines (169 loc) · 4.19 KB
/
magic orange
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
import algoplay as play
import random
orange = play.new_image(
image = "Assets/P03.png",
x=0,
y=100,
size = 500
)
table = play.new_image(
image = "Assets/Pozadie.png",
x=0,
y=-200,
size = 300
)
start_button = play.new_image(
image = "Assets/startbutton.png",
x=0,
y=-50,
size = 50
)
obstacle1 = play.new_image(
image = "Assets/was.png",
x=400,
y=-76,
size = 300
)
obstacle2 = play.new_image(
image = "Assets/was.png",
x=400,
y=-76,
size = 300
)
obstacle3 = play.new_image(
image = "Assets/was.png",
x=400,
y=-76,
size = 300
)
trump = play.new_image(
image = "Assets/trump.png",
x=0,
y=0,
size = 120
)
end = play.new_text(
words= "YOU WERE EATEN BY TRUMP, LOL",
font_size = 60,
color = "red"
)
score = play.new_text(
y = -100,
words= "",
font_size = 60,
color = "green"
)
orange.image = "Assets/P01.png"
obstacle1.hide()
obstacle2.hide()
obstacle3.hide()
trump.hide()
end.hide()
score.hide()
play.set_backdrop('light blue')
table.start_physics(can_move = False, stable = True, bounciness = 0, y_speed=0,friction=0)
#<>
death = 2
i = 3
difficulty = 1
@start_button.when_clicked
async def do():
global death
start_button.hide()
orange.x = -200
orange.y = 100
orange.image = "Assets/P03.png"
orange.start_physics(can_move = True, stable = True, bounciness = 0,friction=0)
await play.timer(2)
death = 0
@play.repeat_forever
async def animate():
global death
if death == 0:
global i
await play.timer(0.1)
if i == 3:
orange.image = "Assets/P03.png"
i = 4
elif i == 4:
orange.image = "Assets/P04.png"
i = 3
@play.repeat_forever
async def jump():
global death
if death == 0:
if play.key_is_pressed("w"):
if orange.y <= -49 and orange.y >= -50:
n = 0
while n != 20:
await play.timer(0.01)
orange.y += 7
n+=1
@play.repeat_forever
def collisioncheck():
global death
global difficulty
if orange.is_touching(obstacle1):
if death == 0:
death = 1
orange.image = "Assets/was.png"
score.words = "Score: ", difficulty - 1
trump.show()
end.show()
score.show()
@play.repeat_forever
async def spawnobstacles():
global death
global difficulty
numberofobs = 1
if death == 0:
speed = 5
time = random.randint(5,20)/10
if difficulty > 30:
numberofobs = 3
elif difficulty > 50:
speed = difficulty/10
elif difficulty < 30:
numberofobs = round(random.randint(difficulty,300)/100)
await play.timer(time)
if numberofobs == 1:
obstacle1.show()
obstacle1.x = 500
v = 0
while v != 200:
await play.timer(0.001)
obstacle1.x -= speed
v+=1
obstacle1.hide()
elif numberofobs == 2:
obstacle1.show()
obstacle2.show()
obstacle1.x = 500
obstacle2.x = 530
v = 0
while v != 200:
await play.timer(0.001)
obstacle1.x -= speed
obstacle2.x -= speed
v+=1
obstacle1.hide()
obstacle2.hide()
elif numberofobs == 3:
obstacle1.show()
obstacle2.show()
obstacle3.show()
obstacle1.x = 500
obstacle2.x = 530
obstacle3.x = 560
v = 0
while v != 200:
await play.timer(0.001)
obstacle1.x -= speed
obstacle2.x -= speed
obstacle3.x -= speed
v+=1
obstacle1.hide()
obstacle2.hide()
obstacle3.hide()
difficulty += numberofobs
play.start_program()