User prompt
bullet moving verticaly
User prompt
fix
User prompt
player auto moving horizontaly
User prompt
player auto move horizontal left and right. shooting when taping
User prompt
make 100 waves level
User prompt
make waves level until 100 wave
User prompt
make perfect
Code edit (1 edits merged)
Please save this source code
User prompt
Retro Commando: 8-Bit Assault
Initial prompt
make top down 8 bit look a like contra game with edit code import pygame import random import sys # Initialize pygame pygame.init() # Screen dimensions SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT)) pygame.display.set_caption("8-Bit Contra-like") # Colors BLACK = (0, 0, 0) WHITE = (255, 255, 255) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) # Player class class Player(pygame.sprite.Sprite): def __init__(self): super().__init__() self.image = pygame.Surface((30, 50)) self.image.fill(GREEN) self.rect = self.image.get_rect() self.rect.x = 100 self.rect.y = SCREEN_HEIGHT - 150 self.speed_x = 0 self.speed_y = 0 self.jumping = False self.health = 100 self.shoot_delay = 250 # milliseconds self.last_shot = pygame.time.get_ticks() def update(self): # Gravity if self.jumping: self.speed_y += 0.8 if self.speed_y > 10: self.speed_y = 10 # Update position self.rect.x += self.speed_x self.rect.y += self.speed_y # Keep player on screen if self.rect.left < 0: self.rect.left = 0 if self.rect.right > SCREEN_WIDTH: self.rect.right = SCREEN_WIDTH if self.rect.bottom > SCREEN_HEIGHT - 100: self.rect.bottom = SCREEN_HEIGHT - 100 self.jumping = False self.speed_y = 0 def jump(self): if not self.jumping: self.jumping = True self.speed_y = -15 def shoot(self): now = pygame.time.get_ticks() if now - self.last_shot > self.shoot_delay: self.last_shot = now bullet = Bullet(self.rect.right, self.rect.centery) all_sprites.add(bullet) bullets.add(bullet) # Bullet class class Bullet(pygame.sprite.Sprite): def __init__(self, x, y): super().__init__() self.image = pygame.Surface((10, 5)) self.image.fill(RED) self.rect = self.image.get_rect() self.rect.left = x self.rect.centery = y self.speed = 10 def update(self): self.rect.x += self.speed # Remove if it goes off screen if self.rect.left > SCREEN_WIDTH: self.kill() # Enemy class class Enemy(pygame.sprite.Sprite): def __init__(self): super().__init__() self.image = pygame.Surface((30, 40)) self.image.fill(RED) self.rect = self.image.get_rect() self.rect.x = random.randrange(SCREEN_WIDTH, SCREEN_WIDTH + 100) self.rect.y = SCREEN_HEIGHT - 140 self.speed = random.randrange(1, 4) def update(self): self.rect.x -= self.speed if self.rect.right < 0: self.rect.x = random.randrange(SCREEN_WIDTH, SCREEN_WIDTH + 100) self.rect.y = SCREEN_HEIGHT - 140 self.speed = random.randrange(1, 4) # Platform class class Platform(pygame.sprite.Sprite): def __init__(self, x, y, width, height): super().__init__() self.image = pygame.Surface((width, height)) self.image.fill(BLUE) self.rect = self.image.get_rect() self.rect.x = x self.rect.y = y # Create sprite groups all_sprites = pygame.sprite.Group() enemies = pygame.sprite.Group() bullets = pygame.sprite.Group() platforms = pygame.sprite.Group() # Create player player = Player() all_sprites.add(player) # Create platforms ground = Platform(0, SCREEN_HEIGHT - 100, SCREEN_WIDTH, 100) platforms.add(ground) all_sprites.add(ground) # Create some floating platforms for i in range(3): p = Platform(random.randrange(0, SCREEN_WIDTH - 100), random.randrange(200, SCREEN_HEIGHT - 200), 100, 20) platforms.add(p) all_sprites.add(p) # Create enemies for i in range(8): enemy = Enemy() all_sprites.add(enemy) enemies.add(enemy) # Game loop clock = pygame.time.Clock() score = 0 running = True font = pygame.font.SysFont('Arial', 24) while running: # Keep loop running at the right speed clock.tick(60) # Process input (events) for event in pygame.event.get(): if event.type == pygame.QUIT: running = False elif event.type == pygame.KEYDOWN: if event.key == pygame.K_SPACE: player.jump() if event.key == pygame.K_f: player.shoot() # Get pressed keys keys = pygame.key.get_pressed() player.speed_x = 0 if keys[pygame.K_LEFT]: player.speed_x = -5 if keys[pygame.K_RIGHT]: player.speed_x = 5 # Update all_sprites.update() # Check if bullets hit enemies hits = pygame.sprite.groupcollide(bullets, enemies, True, True) for hit in hits: score += 10 enemy = Enemy() all_sprites.add(enemy) enemies.add(enemy) # Check if player hits enemies hits = pygame.sprite.spritecollide(player, enemies, False) if hits: player.health -= 1 if player.health <= 0: running = False # Draw / render screen.fill(BLACK) all_sprites.draw(screen) # Draw HUD score_text = font.render(f"Score: {score}", True, WHITE) health_text = font.render(f"Health: {player.health}", True, WHITE) screen.blit(score_text, (10, 10)) screen.blit(health_text, (10, 40)) # Flip the display pygame.display.flip() pygame.quit() sys.exit()
/**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 });
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
8 bit image city of newyork with black sky night. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
8 bit image black rocket with fire tail. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
8 bit front image blue red scifi police drone. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
fire explode with piece of black steel. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
fire ball. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows