python invaders style concept game example
# invaders style concept using pygame and colored squares # enemy ship goes back and forth across the screen starting from top and working down as bullets hit them # player ship moves left and right and shoots bullets # player ship is destroyed when hit by enemy ship # player score is number of enemy ships destroyed # player score is number of shots taken # player score is time taken to destroy all enemy ships # sometimes my constants have a tendency to become variable. sorry. # https://pythonprogrammingsnippets.tumblr.com import pygame import random # Set up the game window WINDOW_WIDTH = 600 WINDOW_HEIGHT = 800 WINDOW_TITLE = "Invaders Style Clone" pygame.init() window = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT)) pygame.display.set_caption(WINDOW_TITLE) # Define some colors BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREEN = (0, 255, 0) RED = (255, 0, 0) # Define the player's spaceship PLAYER_WIDTH = 50 PLAYER_HEIGHT = 50 PLAYER_X = (WINDOW_WIDTH - PLAYER_WIDTH) / 2 PLAYER_Y = WINDOW_HEIGHT - PLAYER_HEIGHT - 50 player = pygame.Rect(PLAYER_X, PLAYER_Y, PLAYER_WIDTH, PLAYER_HEIGHT) # Define the player's movement PLAYER_MOVE_SPEED = 1 # Define the enemy's spaceship ENEMY_WIDTH = 50 ENEMY_HEIGHT = 50 ENEMY_X = 0 ENEMY_Y = 0 enemy = pygame.Rect(ENEMY_X, ENEMY_Y, ENEMY_WIDTH, ENEMY_HEIGHT) # Define the enemy's grid ENEMY_GRID_WIDTH = 10 ENEMY_GRID_HEIGHT = 5 ENEMY_GRID_X = 0 ENEMY_GRID_Y = 0 enemy_grid = pygame.Rect(ENEMY_GRID_X, ENEMY_GRID_Y, ENEMY_GRID_WIDTH, ENEMY_GRID_HEIGHT) # Define the enemy's movement ENEMY_MOVE_SPEED = 1 ENEMY_MOVE_DIRECTION = 1 # start enemy at top and work down as bullets hit them ENEMY_START_Y = 0 # Define the player's bullets BULLET_WIDTH = 10 BULLET_HEIGHT = 20 BULLET_X = 0 BULLET_Y = 0 bullet = pygame.Rect(BULLET_X, BULLET_Y, BULLET_WIDTH, BULLET_HEIGHT) # Define the player's bullets movement BULLET_MOVE_SPEED = 2 # Define the player's score shots_taken = 0 score = 0 # Define the game loop running = True while running: time_started = pygame.time.get_ticks() # Check for events for event in pygame.event.get(): if event.type == pygame.QUIT: running = False # Check for key presses # if player presses left and player is already going left, then stop movement keys = pygame.key.get_pressed() if keys[pygame.K_LEFT] and player.x > 0: player.x -= PLAYER_MOVE_SPEED if keys[pygame.K_RIGHT] and player.x + player.width = WINDOW_WIDTH: ENEMY_MOVE_DIRECTION *= -1 # Check if the bullet has hit the enemy if bullet.colliderect(enemy): score += 1 # now start enemy at top and work down as bullets hit them and spawn new enemy # move down one tile size ENEMY_START_Y += ENEMY_HEIGHT enemy.x = ENEMY_START_Y enemy.y = ENEMY_START_Y bullet.x = 0 bullet.y = 0 # increase bullet speed BULLET_MOVE_SPEED += 1 # increase enemy speed ENEMY_MOVE_SPEED += 1 # Check if the enemy has hit the player if enemy.colliderect(player): running = False # Draw the game window.fill(BLACK) pygame.draw.rect(window, WHITE, player) pygame.draw.rect(window, RED, enemy) pygame.draw.rect(window, GREEN, bullet) # Update the game pygame.display.update() # limit the game to 60 frames per second clock = pygame.time.Clock() clock.tick(60) # output time and score print("Time: " + str(pygame.time.get_ticks() - time_started)) print("Score: " + str(score)) print("Shots Taken: " + str(shots_taken)) pygame.quit()
1 note
·
View note
zim VS topher bus
ok not gonna spend time explaining it you knwo what to do. this is the FINAL ROUND so whoever gets the more votes will be elected floppest loser girlfail of this poll ok now lets go
masterpost
90 notes
·
View notes
20 notes
·
View notes
me when i see topher bus
87 notes
·
View notes
When youre proud of your padawan and looking at her proud and your gay captain is looking at you
287 notes
·
View notes
Erm, I hate to ask but- What are those scars on your body? The one on your arm and the scratches on your belly?
Erm: (A while ago I encountered this clone by The Heap. They were in my way so I pushed them, as I usually have to do. That’s when the rabble around us scurried out of sight as if a warhead was about to fall where we stood. Unbeknownst to me at the time this…“Fake Peppino” APPARENTLY has a reputation for violent outbursts, and I just provoked them into mauling me.)
(It’s a miracle I got away, my throat nearly got torn out about five times over.)
(Funny you ask that because I had the same question myself after my ass beating. I asked around to see if anyone had experienced Fake Peppino’s wrath like I did. Turns out, nobody has ever seen anyone come out from a fight with them alive. Usually not even in one piece.)
(So to my knowledge I am the only one that has lived to tell the tale.)
(…I think I’d rather starve than go back there.)
85 notes
·
View notes
Anakin’s a Dragon.
That’s it. That’s my fic brainrot atm. I have been rotating the idea in my mind for a while now, and I think it might actually develop into A Thing.
I should specify- Anakin can turn Into A Dragon. He gets bought by the Sith as a kid, and raised as a tool.
Obi-wan takes Ahsoka on as a Padawan, and eventually at some point during the War they all cross paths.
Obi/Ani would be end game. I just want cute Obi and draganakin cuddles. Obi guiding Anakin back to some sense of self and personhood. Etc etc etc
And angst. I want some Angst too.
14 notes
·
View notes
413 notes
·
View notes
Barriss Offee Watchlist
WARNING: The following may contain spoilers for the Star Wars Expanded Universe, especially for several series*. Episodes are in an approximate timeline order (updated as of 5/10/24).
*Series entries are listed as Season:Episode.
The Clone Wars:
"The Padawan Arc" (~22 BBY)
2:6 Weapons Factory
2:7 Legacy of Terror
2:8 Brain Invaders
"The Fallen Jedi Arc" (~20 BBY)
5:17 Sabotage
5:18 The Jedi Who Knew Too Much
5:19 To Catch a Jedi
5:20 The Wrong Jedi
Tales of The Empire (~19-8 BBY):
Episode IV: Devoted
Episode V: Realization
Episode VI: The Way Out
10 notes
·
View notes
ok im going to say this now before i forget
I had a dream about a random official LMK storyboard, that involved Wukong making clones. one of them. Was a porty clone version of him. AND HE FRICKIN LOOKED LIKE ONE OF THOSE 80S DISCO DUDES.
WITH THE HAIR AND EVERYTHING
21 notes
·
View notes
tbh, I could of solo'ed #2 Flowey if they were here.
9/20 - Truth spell
17 notes
·
View notes
Fighting against a mesm- (Interrupt!)
Fighting against a- (Interrupt!)
Fighting again- (Interrupt!)
Fighting against...myself?
Fighting against a mesmer sure is- (Interrupt!)
Where'd they go? Oh there
Fighting-
(You have been defeated)
Fighting against a mesmer sure is hard.
7 notes
·
View notes
me: [clutching my head] [trough gritted teeth] i love painting i love rendering i love coloring (i am gaslighting myself)
anyway yknow the clone-dib theory? bc i know and love the clone dib theory and think so should you
24 notes
·
View notes
[Scudworth is disguised as a shadowy board member]
Scudworth: I am government man, I come from the government. The government has sent me.
10 notes
·
View notes
If I had a credit for every time Ahsoka was trapped in hyperspace with mind-controlled clones, I would have two credits which isn't a lot, but it's weird that it has happened twice.
7 notes
·
View notes