Python İle Among Us

Jun 26, 20215 dakika

Pygame İle Among Us Resimleri











bunlar resimmler di mouse ile hareket ettirip q ya basınc deydiği crew mateleri öldürür imposter yeşilli bir bug var çözemedim ölülere crewmatelerden biri deyerse oyun bitsin oyunun kodları resimler var onları indirirsiniz tam 215 satır

kodlar

from PyQt5.QtWidgets import *

from PyQt5.QtCore import *

from PyQt5.QtGui import *

import pygame

import sys



class window(QWidget):



def __init__(self):



super().__init__()

self.init()



def init(self):



self.setWindowTitle("Among Us")

self.layout=QVBoxLayout()

self.widgets()

self.setLayout(self.layout)

self.show()



def widgets(self):



self.logo=QLabel()

self.png=QPixmap("startLogo.png")

self.logo.setPixmap(self.png)

self.layout.addWidget(self.logo)



self.info=QFont("Helvetica",30,italic=True)

self.label=QLabel("""wasd ile hareket edin <br>

q ile öldürün <br>

eğer crewmateler ölüyü görürse kaybedersiniz""")



self.button=QPushButton("OYNA")

self.button.clicked.connect(self.game)

self.layout.addWidget(self.button)



self.setFont(self.info)

self.layout.addWidget(self.label)



def game(self):



class main_(object):



def __init__(self,keyboard):



self.name="among us"

self.version=0.1

self.keyboard=keyboard



def __str__(self):

return self.name



def __int__(self):

return self.version



def start(self):



self.settings()

self.init()

self.loop()



def settings(self):



self.w=900

self.h=800

self.bg=(55,55,55)

self.FPS=45

self.turnList=[[-1,-1],[1,-1],[-1,1]]

self.spriteW=80

self.spriteH=100



def init(self):



pygame.init()

self.window=pygame.display.set_mode((self.w,self.h))

self.sprites()



def events(self):



for event in pygame.event.get():

if event.type == pygame.QUIT:

sys.exit()



def sprites(self):



self.spriteGroup=pygame.sprite.Group()

self.imposterGroup=pygame.sprite.Group()

self.crewmateGroup =pygame.sprite.Group()



self.imposter = self.createSprite(0,self.h-100,"images/green.png")

self.red=self.createSprite(0,0,"images/red.png")

self.blue=self.createSprite(self.w/2-25,self.h/2-50,"images/cyan.png")

self.pink=self.createSprite(self.w-80,self.h-100,"images/purple.png")

self.crewmatesList = [self.red, self.blue, self.pink]



self.spriteGroup.add(self.red, self.blue, self.pink, self.imposter)

self.imposterGroup.add(self.imposter)

self.crewmateGroup.add(self.red, self.blue, self.pink)



self.deadList=list()



def playerMove(self):



if self.keyValue[pygame.K_w]:

self.imposter.rect.y -= 7



if self.keyValue[pygame.K_a]:

self.imposter.rect.x -= 7



if self.keyValue[pygame.K_s]:

self.imposter.rect.y += 7



if self.keyValue[pygame.K_d]:

self.imposter.rect.x += 7



if self.imposter.rect.x < 0:

self.imposter.rect.x = 0



if self.imposter.rect.x > self.w - self.spriteW:

self.imposter.rect.x = self.w - self.spriteW



if self.imposter.rect.y < 0:

self.imposter.rect.y = 0



if self.imposter.rect.y > self.h - self.spriteH:

self.imposter.rect.y = self.h - self.spriteH



def mouse(self):



self.imposter.rect.x=pygame.mouse.get_pos()[0]

self.imposter.rect.y=pygame.mouse.get_pos()[1]



def dead(self):



for i in range(3):

if self.keyValue[pygame.K_q] and pygame.sprite.spritecollide(self.crewmatesList[i],self.imposterGroup,False):



self.srf = pygame.Surface((100, 50))

self.crewmatesList[i].image=pygame.image.load("images/dead.png")

self.turnList[i]=[0,0]

self.deadList.append(self.crewmatesList[i])



for dead in self.deadList:



if pygame.sprite.spritecollide(dead,self.crewmateGroup,False):

#pygame.time.wait(1000)

#sys.exit()

pass



if len(set(self.deadList))==3:

print("Wictory")

sys.exit()



def moves(self):



self.spriteList=(self.red,self.blue,self.pink)



for i in range(3):



sprt=self.spriteList[i]

trn=self.turnList[i]



sprt.rect.x+=5*trn[0]

sprt.rect.y+=5*trn[1]



if sprt.rect.x<0 or sprt.rect.x>self.w-self.spriteW:

trn[0]*=-1



if sprt.rect.y<0 or sprt.rect.y>self.h-self.spriteH:

trn[1]*=-1



def loop(self):



while True:



self.window.fill(self.bg)

self.spriteGroup.draw(self.window)

self.keyValue = pygame.key.get_pressed()

self.events()



if self.keyboard:

self.playerMove()



else:

self.mouse()



self.dead()

self.moves()



pygame.time.Clock().tick(self.FPS)

pygame.display.update()



def createSprite(self,x,y,load):



class createSprite(pygame.sprite.Sprite):

def __init__(self,x,y,load):



super().__init__()

self.image = pygame.image.load(load)

self.rect = self.image.get_rect()

self.rect.x=x

self.rect.y=y



sprite=createSprite(x,y,load)

return sprite



main_=main_(False)

main_.start()



if __name__ == '__main__':



app=QApplication(sys.argv)

window=window()

sys.exit(app.exec())

Küçük bir destek binlerce beğeniden daha değerlidir
https://bylge-images.s3-eu-west-1.amazonaws.com/8a860ee0-ebb9-11ea-98cf-0d9846403006.jpeg
Python

a={ "yas":12, "dil":"Python", "kütüphane":[pygame,kivy], "sıkılma durumu":True } print(a)

Bylge Icon
Bylge Icon