-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathburger_boy.py
More file actions
597 lines (542 loc) · 22.3 KB
/
burger_boy.py
File metadata and controls
597 lines (542 loc) · 22.3 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
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
# Logan's Project
import pygame
import time
import sys
from pygame.locals import *
import random
pygame.init()
height = 20
fatness = 20
fattallness = 20
poop = 0
pointcounter = 0
x = random.randint(1, 10)
level = 1
start = 1
life = 1000
bulletmove = 1
bullet_speed = 17
burgerkinghealth = 5
burgerkingspeech = 1
burger_king = pygame.Rect(640, 100, 40, 80)
bullet1 = pygame.Rect(1, 660, 15, 15)
bullet2 = pygame.Rect(1, 680, 15, 15)
bullet3 = pygame.Rect(1, 700, 15, 15)
bullet4 = pygame.Rect(1, 720, 15, 15)
bullet5 = pygame.Rect(1, 740, 15, 15)
bullet6 = pygame.Rect(1, 760, 15, 15)
bullet7 = pygame.Rect(1, 780, 15, 15)
bullet8 = pygame.Rect(1, 800, 15, 15)
bullet9 = pygame.Rect(1, 820, 15, 15)
bullet10 = pygame.Rect(1, 840, 15, 15)
bullett1 = pygame.Rect(570, 350, 20, 20)
bullett2 = pygame.Rect(610, 350, 20, 20)
bullett3 = pygame.Rect(650, 350, 20, 20)
bullett4 = pygame.Rect(690, 350, 20, 20)
bullett1moving = False
bullett2moving = False
bullett3moving = False
bullett4moving = False
sideline_left = pygame.Rect(0, 0, 1, 920)
sideline_right = pygame.Rect(1279, 0, 1, 920)
sideline = [sideline_left, sideline_right]
bullet = [bullet1, bullet2, bullet3, bullet4, bullet5, bullet6, bullet7, bullet8, bullet9, bullet10]
bullett = [bullett1, bullett2, bullett3, bullett4]
screen = pygame.display.set_mode((1280, 920))
screen.fill((236, 136, 21))
pygame.display.set_caption('Burger Boy by Logan Gier')
main_clock = pygame.time.Clock()
player = pygame.Rect(640, 900, fatness, 20)
player_speed = 10
point = 0
wall11 = pygame.Rect(0, 490, 630, 15)
wall12 = pygame.Rect(650, 490, 640, 15)
wall13 = pygame.Rect(10, 440, 1260, 15)
wall14 = pygame.Rect(0, 390, 1280, 15)
wall15 = pygame.Rect(10, 340, 1270, 15)
walll21 = pygame.Rect(0, 455, 1280, 10)
# walll22 = pygame.Rect()
walll = [walll21]
bathroom = pygame.Rect(1260, 900, 20, 20)
font = pygame.font.SysFont(None, 36)
def draw_text(display_string, font, surface, x, y):
text_display = font.render(display_string, 1, (255, 0, 0,))
text_rect = text_display.get_rect()
text_rect.topleft = (x, y)
surface.blit(text_display, text_rect)
bouncepad = pygame.Rect(630, 435, 20, 5)
bouncepad_two = pygame.Rect(630, 0, 20, 5)
bouncepadlvltwo = pygame.Rect(15, 500, 20, 10)
bouncepadtwolvltwo = pygame.Rect(1245, 500, 20, 10)
lvltwobouncepad = [bouncepadlvltwo, bouncepadtwolvltwo]
wall = [wall11, wall12, wall13, wall14, wall15]
burger_patty = pygame.Rect(1040, 45, 40, 20)
cheese = pygame.Rect(1040, 35, 40, 10)
top_bun = pygame.Rect(1040, 25, 40, 10)
bottom_bun = pygame.Rect(1040, 65, 40, 10)
counter = 12
burger = [burger_patty, cheese, top_bun, bottom_bun]
move_left = False
move_right = False
move_up = False
move_down = False
fatcount = 0
for _ in range(0, 2):
rny = random.randint(0, 880)
rnx = random.randint(0, 1230)
burger_patty = pygame.Rect(rnx, rny, 40, 20)
cheese = pygame.Rect(rnx, rny - 10, 40, 10)
top_bun = pygame.Rect(rnx, rny - 20, 40, 10)
bottom_bun = pygame.Rect(rnx, rny + 20, 40, 10)
burger.append(burger_patty)
burger.append(cheese)
burger.append(top_bun)
burger.append(bottom_bun)
while True:
if level == 1:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == KEYDOWN:
if event.key == K_a:
move_right = False
move_up = False
move_down = False
move_left = True
if event.key == K_d:
move_left = False
move_up = False
move_down = False
move_right = True
if event.key == K_w:
move_left = False
move_right = False
move_down = False
move_up = True
if event.key == K_s:
move_left = False
move_right = False
move_up = False
move_down = True
if event.type == KEYUP:
if event.key == K_a:
move_left = False
if event.key == K_d:
move_right = False
if event.key == K_w:
move_up = False
if event.key == K_s:
move_down = False
if event.key == K_r:
height = 20
fatness = 20
fattallness = 20
poop = 0
pointcounter = 0
player_speed = 10
point = 0
player.x = 640
player.y = 900
level = 1
main_clock.tick(30)
if move_left and player.left > 0:
player.x -= player_speed
if move_right and player.right < 1280:
player.x += player_speed
if move_up and player.y > 0:
player.y -= player_speed
if move_down and player.y < 920:
player.y += player_speed
screen.fill((236, 136, 21))
for walls in wall:
pygame.draw.rect(screen, (0, 0, 0), walls)
if player.colliderect(walls):
if move_down:
player.y -= player_speed
elif move_up:
player.y += player_speed
elif move_left:
player.x += player_speed
elif move_right:
player.x -= player_speed
pygame.draw.rect(screen, (0, 0, 255), bouncepad_two)
if player.colliderect(bouncepad_two):
if move_down:
player.y -= player_speed
elif move_up:
player.y += 900
elif move_left:
player.x += player_speed
elif move_right:
player.x -= player_speed
pygame.draw.rect(screen, (255, 0, 0), bouncepad)
if player.colliderect(bouncepad):
if move_down:
player.y -= 60
elif move_up:
player.y += player_speed
elif move_left:
player.x += player_speed
elif move_right:
player.x -= player_speed
player = pygame.Rect(player.x, player.y, fatness, fattallness)
pygame.draw.rect(screen, (255, 211, 155), player)
if counter < 400:
for x in range(0, 2):
rny = random.randint(0, 880)
rnx = random.randint(0, 1230)
burger_patty = pygame.Rect(rnx, rny, 40, 20)
cheese = pygame.Rect(rnx, rny - 10, 40, 10)
top_bun = pygame.Rect(rnx, rny - 20, 40, 10)
bottom_bun = pygame.Rect(rnx, rny + 20, 40, 10)
burger.append(burger_patty)
burger.append(cheese)
burger.append(top_bun)
burger.append(bottom_bun)
counter += 4
# slims when not moving
if (not move_left) and (not move_up) and (not move_right) and (not move_down) and fatness >= 0:
fatcount += 1
if fatcount == 10:
fatness -= 2
fattallness -= 1
fatcount = 0
else:
fatcount = 0
for burgers in burger:
if player.colliderect(burgers):
burger.remove(burgers)
fatness += 1
fattallness = height + fatness / 2
# if fattallness >=20:
# fattallness = 30
point += 1
counter -= 1
pygame.draw.rect(screen, (255, 255, 255), bathroom)
if player.colliderect(bathroom):
if move_down:
player.y -= player_speed
fatness -= 10
fattallness -= 5
poop += 1
if poop > 10:
point -= 4
elif move_up:
player.y += player_speed
elif move_left:
player.x += player_speed
elif move_right:
player.x -= player_speed
fatness -= 8
fattallness -= 4
poop += 1
if poop > 10:
point -= 4
count = 0
for burgers in burger:
if count == 0:
pygame.draw.rect(screen, (92, 51, 23), burgers)
if count == 1:
pygame.draw.rect(screen, (255, 215, 0), burgers)
if count == 2:
pygame.draw.rect(screen, (255, 193, 37), burgers)
if count == 3:
pygame.draw.rect(screen, (255, 193, 37), burgers)
count += 1
if count == 4:
count = 0
if fatness <= 0:
pointcounter += 1
if pointcounter == 5:
point -= 5
pointcounter = 0
if point < 0:
screen.fill((255, 100, 0))
draw_text('5000 years ago man was challenged with the idea to eat 250 burgers in under 10 minutes.', font,
screen, 5, 120)
draw_text(
'Your great great grandfather was the 18th to reach 200 burgers. By the time of his death everyone remembered',
font, screen, 5, 140)
draw_text(
'him \'Alexander the Great\'. After his record of 214 burgers everyone was motivated to reach the big 250,',
font, screen, 5, 160)
draw_text('but none were great enough. Then one day his daughter, Alice the Great, was able to eat', font,
screen, 5, 180)
draw_text(
'219 burgers in under 10 minutes. After Alice, there were the brothers, George and Bob the Great,',
font, screen, 5, 200)
draw_text(
'who were the new up and coming eaters. Competing, they were able to shatter their mother\'s record and ate',
font, screen, 5, 220)
draw_text(
'233 burgers each in 10 minutes. Finally the day came and George passed away, after this Bob was sent into',
font, screen, 5, 240)
draw_text(
'Burgerland which forced him to keep eating until he reached 1000 pounds. Bob was reincarnated 3 times',
font, screen, 5, 260)
draw_text(
'before he was able to reach 1000 pounds, but the second he arrived back on Earth he was sent into a coma.',
font, screen, 5, 280)
draw_text(
'While Bob was in a coma, George was reincarnated into a man named Thomas the Train, but he craved burgers,',
font, screen, 5, 300)
draw_text(
'so much that a curse was put onto his family. The curse was that if he didn\'t eat burgers within a certain',
font, screen, 5, 320)
draw_text(
'amount of time he would lose size and weight. Thomas (George) kept eating burgers until he died,',
font, screen, 5, 340)
draw_text(
'but in 10 minutes he still only could eat 243 burgers. His son, your father, was always the fatest kid',
font, screen, 5, 360)
draw_text(
'growing up because of his weird desease that the doctors were calling... \'NoBurgerPhobiaOfEpicProportions\'',
font, screen, 5, 380)
draw_text(
'he had to constantly eat burgers, but one day he couldn\'t take it anymore and ate cookies instead.',
font, screen, 5, 400)
draw_text(
'It was a painful death, but the Burger Gods were not pleased with his change of heart and chose for his legacy',
font, screen, 5, 420)
draw_text(
'to come to Burgerland.Just as Bob did, you have to reach the goal that your predecessors couldn\'t reach,',
font, screen, 5, 440)
draw_text(
'250 burgers in under 10 minutes.This is Your Job, the Burger Gods decided that if you were able to eat',
font, screen, 5, 460)
draw_text(
'250 burgers in under 10 minutes you could leave. And they have told your previous incarnates that you could',
font, screen, 5, 480)
draw_text(
'also break the curse of the need for burger meat. You could break the record and you could be remembered as',
font, screen, 5, 500)
draw_text(
'the Greatest Burger Eater ever. Some day you will do it, but today is not that day. Goodbye... You Lose!',
font, screen, 5, 520)
###############################
if point >= 100 and level == 1:
screen.fill((236, 136, 21))
draw_text('You Win!', font, screen, 500, 400)
draw_text('After Reaching 1000 pounds you obtained a TV Show', font, screen, 350, 500)
draw_text('\'My 1000 Pound Life\' Was Hysterical as people watched you roll around eating burgers', font,
screen, 200, 550)
pygame.display.update()
time.sleep(3)
level += 1
point = 0
start = 0
player_speed = 10 - point/100
draw_text('Points = %s Pounds' % point, font, screen, 5, 5)
draw_text('Speed = %s rolls per second' % player_speed, font, screen, 5, 85)
pygame.display.update()
if level == 2:
if start == 0:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
screen.fill((236, 136, 21))
pygame.display.update()
draw_text('You Thought You Won', font, screen, 500, 400)
draw_text('But There is Always More', font, screen, 450, 450)
pygame.display.update()
time.sleep(2)
draw_text('Welcome! I am the king...', font, screen, 450, 500)
pygame.display.update()
time.sleep(2)
draw_text('The Burger King', font, screen, 450, 550)
pygame.display.update()
time.sleep(2)
screen.fill((236, 136, 21))
pygame.display.update()
time.sleep(1)
# draw_text ('Coming Soon...', font, screen, 500, 400)
# pygame.display.update()
# time.sleep(2)
start += 1
elif start == 1:
screen.fill((255, 255, 255))
player = pygame.Rect(640, 900, 10, 20)
pygame.display.update()
start += 1
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == KEYDOWN:
if event.key == K_a:
move_right = False
move_up = False
move_down = False
move_left = True
if event.key == K_d:
move_left = False
move_up = False
move_down = False
move_right = True
if event.key == K_w:
move_left = False
move_right = False
move_down = False
move_up = True
if event.key == K_s:
move_left = False
move_right = False
move_up = False
move_down = True
if event.type == KEYUP:
if event.key == K_a:
move_left = False
if event.key == K_d:
move_right = False
if event.key == K_w:
move_up = False
if event.key == K_s:
move_down = False
main_clock.tick(30)
screen.fill((0, 0, 0))
player_speed = 4
if move_left and player.left > 0:
player.x -= player_speed
if move_right and player.right < 1280:
player.x += player_speed
if move_up and player.y > 0:
player.y -= player_speed
if move_down and player.y < 920:
player.y += player_speed
for wallls in walll:
pygame.draw.rect(screen, (255, 0, 0), wallls)
if player.colliderect(wallls):
if move_down:
player.y -= player_speed
elif move_up:
player.y += player_speed
elif move_left:
player.x += player_speed
elif move_right:
player.x -= player_speed
pygame.draw.rect(screen, (236, 136, 21), burger_king)
if player.colliderect(burger_king):
burgerkinghealth -= 1
player.x = 640
player.y = 900
pygame.display.update()
if burgerkinghealth == 4:
screen.fill((0, 0, 0))
pygame.display.update()
draw_text('Aaaaaaaargh!', font, screen, 450, 450)
pygame.display.update()
time.sleep(1)
draw_text('Ha! Begginer\'s luck, but you won\'t get me again', font, screen, 450, 500)
bullet_speed += 1
pygame.display.update()
time.sleep(3)
burgerkingspeech += 1
if burgerkinghealth == 3:
screen.fill((0,0,0))
pygame.display.update()
draw_text('Aaaaaaaargh!', font, screen, 450, 450)
pygame.display.update()
time.sleep(1)
draw_text('Lucky Shot! Then Again the luck seems to be on your side.', font, screen, 450, 500)
bullet_speed += 1
pygame.display.update()
time.sleep(1)
draw_text('I have raised the bullets speed to compensate for my lack of luck.', font, screen, 450, 550)
pygame.display.update()
time.sleep(3)
if burgerkinghealth == 2:
screen.fill((0, 0, 0))
pygame.display.update()
draw_text('Aaaaaaaargh!', font, screen, 450, 450)
pygame.display.update()
time.sleep(1)
draw_text('This is ridiculous. How could you possibly beat me?', font, screen, 450, 500)
bullet_speed += 1
pygame.display.update()
time.sleep(1)
draw_text('That was a rhetorical question. You Can\'t beat me!', font, screen, 450, 550)
pygame.display.update()
time.sleep(3)
for lvltwobouncepads in lvltwobouncepad:
pygame.draw.rect(screen, (0, 255, 0), lvltwobouncepads)
if burgerkingspeech == 1:
if player.colliderect(lvltwobouncepads):
if move_down:
player.y -= 400
if move_up:
player.y += player_speed
if move_right:
player.x -= player_speed
if move_left:
player.x += player_speed
elif burgerkingspeech > 1:
bouncepadnumber = random.randint(1, 2)
if bouncepadnumber == 1:
if player.colliderect(bouncepadlvltwo):
if move_down:
player.y -= 400
if move_up:
player.y += player_speed
if move_right:
player.x -= player_speed
if move_left:
player.x += player_speed
elif bouncepadnumber == 2:
if player.colliderect(bouncepadtwolvltwo):
if move_down:
player.y -= 400
if move_up:
player.y += player_speed
if move_right:
player.x -= player_speed
if move_left:
player.x += player_speed
if burgerkinghealth < 3:
for bulletts in bullett:
pygame.draw.rect(screen, (192,192,192), bulletts)
if bullett1moving == False:
if burgerkingspeech > 1:
bullett1moving = True
bullett2moving = True
bullett3moving = True
bullett4moving = True
if bullett1moving == True:
if bullett1.y < 920:
bullett1.y += bullet_speed
if not bullett1.y < 920:
bullett1.y = 350
if bullett2moving == True:
if bullett2.y < 920:
bullett2.y += bullet_speed
if not bullett2.y < 920:
bullett2.y = 360
if bullett3moving == True:
if bullet3.y < 920:
bullett3.y += bullet_speed
if not bullett3.y < 920:
bullett3.y = 370
if bullett4moving == True:
if bullet4.y < 920:
bullett4.y += bullet_speed
if not bullett4.y <920:
bullett4.y = 380
for bullets in bullet:
pygame.draw.rect(screen, (192, 192, 192), bullets)
if bulletmove == 2 and bullets.left > 0:
bullets.x -= bullet_speed
if not bullets.left > 0:
bulletmove = 1
if bulletmove == 1 and bullets.right < 1280:
bullets.x += bullet_speed
if not bullets.right < 1280:
bulletmove = 2
if player.colliderect(bullets):
life -= 5
player.x = 640
player.y = 900
draw_text('LifeForce = %s' % life, font, screen, 5, 5)
draw_text('Burger King Health = %s' % burgerkinghealth, font, screen, 1000, 5)
pygame.draw.rect(screen, (255, 211, 155), player)
pygame.display.update()