User prompt
pon un paisaje de fondo
User prompt
ponle musical relajante
User prompt
pon una forma de mover el jugador
Code edit (1 edits merged)
Please save this source code
User prompt
Block Dodger
Initial prompt
import pygame import random import sys # Inicializar Pygame pygame.init() # Configuración de pantalla ANCHO, ALTO = 500, 500 pantalla = pygame.display.set_mode((ANCHO, ALTO)) pygame.display.set_caption("Esquiva los bloques") # Colores NEGRO = (0, 0, 0) AZUL = (50, 100, 255) ROJO = (255, 50, 50) # Jugador jugador = pygame.Rect(200, 450, 50, 50) # x, y, ancho, alto velocidad_jugador = 7 # Obstáculos obstaculos = [] velocidad_obstaculo = 5 # Reloj reloj = pygame.time.Clock() # Bucle principal while True: # Eventos for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() # Movimiento del jugador teclas = pygame.key.get_pressed() if teclas[pygame.K_LEFT] and jugador.left > 0: jugador.x -= velocidad_jugador if teclas[pygame.K_RIGHT] and jugador.right < ANCHO: jugador.x += velocidad_jugador # Crear obstáculos if random.randint(1, 20) == 1: # probabilidad de crear bloque obstaculos.append(pygame.Rect(random.randint(0, ANCHO-50), 0, 50, 50)) # Mover obstáculos for obstaculo in obstaculos: obstaculo.y += velocidad_obstaculo if obstaculo.colliderect(jugador): # Colisión print("¡Perdiste!") pygame.quit() sys.exit() # Dibujar pantalla.fill(NEGRO) pygame.draw.rect(pantalla, AZUL, jugador) for obstaculo in obstaculos: pygame.draw.rect(pantalla, ROJO, obstaculo) pygame.display.flip() reloj.tick(30) # 30 FPS
/**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 });
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});