Nov-20-2020, 08:26 PM
(This post was last modified: Nov-20-2020, 08:57 PM by Larz60+.
Edit Reason: Fixed tags, use python for code, not quote
)
Hello Guys,
New coders stupid question, using sublime as my IDE, i THOUGHT i had sublime setup correctly for Python however as you can see from the video i am having some issues. With the intellisence, instead of just adding to the end of my line the last few characters i need to be helpful, it adds the entire line again which means i end up with this:
spaceship_group = pygame.sprite.pygame.sprite.Group(*sprites)
instead of this:
spaceship_group = pygame.sprite.Group(*sprites)
See video here
https://www.youtube.com/watch?v=7bS7n3Fs...e=youtu.be
additional annoying this, for some reason it doesn't pick up when i start typing "Pygame"....that's odd right???
I am just trying to work through some tutorials as a distraction to the Team Treehouse training i am also doing so could use some advice :)
in an effort to include everything, below is my code, don't think its needed for this question but just in case i have missed something in the video:
New coders stupid question, using sublime as my IDE, i THOUGHT i had sublime setup correctly for Python however as you can see from the video i am having some issues. With the intellisence, instead of just adding to the end of my line the last few characters i need to be helpful, it adds the entire line again which means i end up with this:
spaceship_group = pygame.sprite.pygame.sprite.Group(*sprites)
instead of this:
spaceship_group = pygame.sprite.Group(*sprites)
See video here
https://www.youtube.com/watch?v=7bS7n3Fs...e=youtu.be
additional annoying this, for some reason it doesn't pick up when i start typing "Pygame"....that's odd right???
I am just trying to work through some tutorials as a distraction to the Team Treehouse training i am also doing so could use some advice :)
in an effort to include everything, below is my code, don't think its needed for this question but just in case i have missed something in the video:
import pygame
from pygame.locals import *
#fps
clock = pygame.time.Clock()
fps = 60
#screen res
screen_width = 600
screen_height = 800
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption("Space Invaders")
#load image
bg = pygame.image.load("img/bg.png")
#create spacship class
class spaceship(pygame.sprite.sprite)
def __init__(self, x, y):
pygame.sprite.sprite.__init__(self)
self.image = pygame.image.load("img/spaceship.png") # load image
self.rect = self.image.get_rect() # force image to rectangle
self.rect.center = [x, y]
#create sprite group
spaceship_group = pygame.sprite.pygame.sprite.Group(*sprites)
def draw_bg():
screen.blit(bg,(0,0))
run = True # Bools need upper case "true" is not correct, must be "True"
while run:
clock.tick(fps)
#draw background
draw_bg()
# event handlers
for event in pygame.event.get():
if event.type == pygame.QUIT: # Quit must be upper case, this one controls the X on display
run = False
pygame.display.update()
pygame.quit()
