@p_loo/

Swamp_Game Ask

Pygame

No description

fork
loading
Files
  • main.py
  • pics
  • boss.py
  • character.py
  • nohup.out
  • z_nohup.out

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.5363511473868343","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IHB5Z2FtZQppbXBvcnQgcmFuZG9tCmZyb20gY2hhcmFjdGVyIGltcG9ydCBDaGFyCmZyb20gYm9zcyBpbXBvcnQgQm9zcwogCiMgRGVmaW5lIHNvbWUgY29sb3JzCkJMQUNLID0gKDAsIDAsIDApCldISVRFID0gKDI1NSwgMjU1LCAyNTUpCkdSRUVOID0gKDExOCwyMzgsMCkKUkVEID0gKDI1NSw0OCw0OCkKIApweWdhbWUuaW5pdCgpCgpzd2FtcCA9IHB5Z2FtZS5pbWFnZS5sb2FkKCJwaWNzL3N3YW1wLnBuZyIpCnN3YW1wID0gcHlnYW1lLnRyYW5zZm9ybS5zY2FsZShzd2FtcCwgKDgwMCw2MDApKQoKIyBTZXQgdGhlIGhlaWdodCBhbmQgd2lkdGggb2YgdGhlIHNjcmVlbgpzaXplID0gWzgwMCw2MDBdCnNjcmVlbiA9IHB5Z2FtZS5kaXNwbGF5LnNldF9tb2RlKHNpemUpCgpib3NzX2xpc3QgPSBweWdhbWUuc3ByaXRlLkdyb3VwKCkKYWxsX3Nwcml0ZXNfbGlzdCA9IHB5Z2FtZS5zcHJpdGUuR3JvdXAoKSAKCnBsYXllciA9IENoYXIoQkxBQ0ssIDMwLCAzMCkKYWxsX3Nwcml0ZXNfbGlzdC5hZGQocGxheWVyKQoKYm9zc19wbGF5ZXIgPSBCb3NzKEJMQUNLLCAzMCwgMzApCmJvc3NfbGlzdC5hZGQoYm9zc19wbGF5ZXIpCmFsbF9zcHJpdGVzX2xpc3QuYWRkKGJvc3NfcGxheWVyKQoKIyBMb29wIHVudGlsIHRoZSB1c2VyIGNsaWNrcyB0aGUgY2xvc2UgYnV0dG9uLgp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cyBsaW5lLCB0aGUgcHJvZ3JhbSB3aWxsICdoYW5nJwojIG9uIGV4aXQuCnB5Z2FtZS5xdWl0KCkK"},"asBuffer":null},"loaded":true}}
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
import pygame
import random
from character import Char
from boss import Boss
 
# Define some colors
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (118,238,0)
RED = (255,48,48)
 
pygame.init()

swamp = pygame.image.load("pics/swamp.png")
swamp = pygame.transform.scale(swamp, (800,600))

# Set the height and width of the screen
size = [800,600]
screen = pygame.display.set_mode(size)

boss_list = pygame.sprite.Group()
all_sprites_list = pygame.sprite.Group() 

player = Char(BLACK, 30, 30)
all_sprites_list.add(player)

boss_player = Boss(BLACK, 30, 30)
boss_list.add(boss_player)
all_sprites_list.add(boss_player)

# Loop until the user clicks the close button.
done = False
 
# Used to manage how fast the screen updates
clock = pygame.time.Clock()
 
health = 200

# -------- Main Program Loop -----------
while not done:
    for event in pygame.event.get():  # User did something
        if event.type == pygame.QUIT:  # If user clicked close
            done = True  
    
    screen.blit(swamp, (0,0))

    all_sprites_list.update()

    pygame.draw.rect(screen, RED, (20,10,200,20))
    pygame.draw.rect(screen, GREEN, (20,10,health,20))

    keys = pygame.key.get_pressed()
    if keys[pygame.K_LEFT]:
        player.moveLeft(20)
    if keys[pygame.K_RIGHT]:
          player.moveRight(20)

    all_sprites_list.draw(screen)
    
    clock.tick(60)
 
    # Go ahead and update the screen with what we've drawn.
    pygame.display.flip()
 
# Be IDLE friendly. If you forget this line, the program will 'hang'
# on exit.
pygame.quit()