Nuestro grupo de especialistas despúes de ciertos días de investigación y de recopilar de datos, han obtenido los datos necesarios, queremos que resulte de gran utilidad en tu proyecto.
Ejemplo 1: como hacer un juego en Python
#Easy game in pythonimport random
import time
Passwordlist =['abc123','1234','123456','QWERT','ASFDJKL;','0102','0','100','1000','10000','123','2048','1024','JSON','1234567890']
ans =input('Enter an account name: ')
time.sleep(1)print('Finding the password for it...')
time.sleep(1)print(random.choice(Passwordlist)+' is the password')
Ejemplo 2: como hacer un juego en Python
# Snake Gameimport turtle
import random
import time
score =0# screen
screen = turtle.Screen()
screen.bgcolor("black")
screen.title("Snake Game By Atharva")
screen.tracer(0)# Snake
snake = turtle.Turtle()
snake.shape("square")
snake.color("green")
snake.penup()
snake_pos ="None"# apple
apple = turtle.Turtle()
apple.shape("circle")
apple.color("red")
apple.penup()
apple.goto(0,100)# classesclassSnakeMovements:
y =0
x =0
snpos = snake_pos
snpos =Nonedefmain(self):if self.snpos =="up":
self.y = snake.ycor()
snake.sety(self.y +15)if self.snpos =="down":
self.y = snake.ycor()
snake.sety(self.y -15)if self.snpos =="right":
self.x = snake.xcor()
snake.setx(self.x +15)if self.snpos =="left":
self.x = snake.xcor()
snake.setx(self.x -15)defSnakeUp(self):
self.snpos ="up"defSnakeDown(self):
self.snpos ="down"defSnakeRight(self):
self.snpos ="right"defSnakeLeft(self):
self.snpos ="left"
instanceVar = SnakeMovements()# Keyboard Binding
screen.listen()
screen.onkeypress(instanceVar.SnakeUp,"Up")
screen.onkeypress(instanceVar.SnakeDown,"Down")
screen.onkeypress(instanceVar.SnakeRight,"Right")
screen.onkeypress(instanceVar.SnakeLeft,"Left")# Mainloop of the gamewhileTrue:if snake.distance(apple)<20:
score +=1print(score)
applex = random.randint(-290,290)
appley = random.randint(-290,290)
apple.goto(applex, appley)
time.sleep(0.1)
instanceVar.main()
screen.update()
Aquí puedes ver las comentarios y valoraciones de los lectores
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)