Jump to content
  • Advertisement

Crazylegs830

Member
  • Content Count

    46
  • Joined

  • Last visited

Community Reputation

226 Neutral

About Crazylegs830

  • Rank
    Member
  1. Crazylegs830

    How do you get souns for your game?

    Ah I didn't even relise thanks.
  2. I was just wondering how you got sounds. If you get them from a website or make them yourself. I misspelled sounds.
  3. Crazylegs830

    Pygame importing images

    Ah, I see thank you very much!
  4. Crazylegs830

    Pygame importing images

    I have been importing image into pygame like this: image = pygame.image.load("C:\\Users\\user\\Desktop\\folder\\images\\Entities\\image.png") Yet if I were to give this game to someone they can't play it, due to having a different user name. How do I fix this?
  5. Crazylegs830

    Pygame errror: IndexError: list index out of range

    I fixed it now was a simple misspell error.
  6. Hello, I was just making a "Stickman" class for the player and I get this error :IndexError: list index out of range Here is the code: import pygame, sys, glob from pygame import * h=400 w=800 screen = pygame.display.set_mode((w,h)) clock = pygame.time.Clock() class player: def __init__(self): self.x = 200 self.y = 300 self.ani_speed_init=10 self.ani_speed=self.ani_speed_init self.ani = glob.glob("C:\Users\user\Desktop\Python Programs\Sprite Example\Entities\Stcik_Man_Walk*.png") self.ani.sort() self.ani_pos=0 self.ani_max = len(self.ani)-1 self.img = pygame.image.load(self.ani[0]) self.update(0) def update(self, pos): if pos != 0: self.ani_speed-=1 self.x+=pos if self.ani_speed == 0: self.img = pygame.image.load(self.ani[self.ani_pos]) self.ani_speed = self.ani_speed_init if self.ani_pos == self.ani_max: self.ani_pos = 0 else: self.ani_pos+=1 screen.blit(self.img,(self.x,self.y)) player1 = player() pos = 0 while 1: screen.fill((255,0,0)) clock.tick(60) for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() elif event.type == KEYDOWN and event.key == K_RIGHT: pos = 1 elif event.type == KEYUP and event.key == K_RIGHT: pos= 0 player1.update(pos) pygame.display.update()
  7. Crazylegs830

    How do I make a very basic inventory.

    l   Alright ill try
  8. Crazylegs830

    How do I make a very basic inventory.

    I am using python/pygame and I am just writing code, I guess. Not really classes as much. Very messy code.   Code:
  9. Crazylegs830

    How do I make a very basic inventory.

    I am still very new to programming and just want to know how to make that collision. Just consumable circles that when the player touches them they disappear or something similar.
  10. Sorry if I am asking questions to fast. How do I make an inventory. All I mean is a touch an item than it appears at the lower right or something.
  11. Crazylegs830

    Circles appear than disappear in python/pygame.

    Thanks I've got it now. Please excuse that messy code.
  12. Crazylegs830

    Circles appear than disappear in python/pygame.

    Thank you very much!
  13. Hey, I have decided to give this another shot. I am trying to make small circles that when you go over and touch they disappear, but the circles I make appear and then disappear right away and then more appear and disappear. My questions are how do I prevent this and how do I make it so only 10 or so spawn.   code: you="C:\\Users\\user\\Desktop\\Python Programs\\Snake\\textures\\you.bmp" import pygame, sys, random from pygame.locals import * pygame.init() screen=pygame.display.set_mode((1600,1120),0,32) mouse_c=pygame.image.load(you).convert_alpha() #Variables for shapes BLUE=(0,64,128) WHITE=(255,255,255) pos1=(0,0) pos2=(0,1130) pos3=(1600,0) pos4=(1600,1130) randpos1=random.randint(0, 1120) randpos2=random.randint(0, 1600) radius=(5) #Variables for shapes x,y=770,560 movex, movey=0,0 #Controls while True: for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() if event.type==KEYDOWN: if event.key==K_LEFT: movex=-4 elif event.key==K_RIGHT: movex=+4 elif event.key==K_UP: movey=-4 elif event.key==K_DOWN: movey=+4 if event.type==KEYUP: if event.key==K_LEFT: movex=0 elif event.key==K_RIGHT: movex=0 elif event.key==K_UP: movey=0 elif event.key==K_DOWN: movey=0 #Controls screen.lock() pygame.draw.circle(screen, WHITE, (random.randint(0, 1600), random.randint(0, 1600)), radius) screen.unlock() x+=movex y+=movey #Collision if y < 0: y = 0 elif y > 1080: y = 1080 if x < 0: x = 0 elif x > 1550: x = 1550 #Collision #Dots screen.blit(mouse_c,(x,y)) pygame.display.update() screen.fill(pygame.Color(0, 0, 0, 255))
  14. Crazylegs830

    Strange dotted line following my "player".

    Thanks you and Eck have been incredibly helpful.
  15. Hello there is a strange dotted line following the "player" I made. By player I mean the thing you control. Thanks here is my code: you="C:\\Users\\user\\Desktop\\Python Programs\\Snake\\textures\\you.bmp" import pygame, sys, random from pygame.locals import * pygame.init() screen=pygame.display.set_mode((1600,1120),0,32) mouse_c=pygame.image.load(you).convert_alpha() #Variables for shapes BLUE=(0,64,128) WHITE=(255,255,255) pos1=(0,0) pos2=(0,1130) pos3=(1600,0) pos4=(1600,1130) randpos1=random.randint(0, 1120) randpos2=random.randint(0, 1600) radius=(5) #Variables for shapes x,y=770,560 movex, movey=0,0 #Controls while True: for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() if event.type==KEYDOWN: if event.key==K_LEFT: movex=-4 elif event.key==K_RIGHT: movex=+4 elif event.key==K_UP: movey=-4 elif event.key==K_DOWN: movey=+4 if event.type==KEYUP: if event.key==K_LEFT: movex=0 elif event.key==K_RIGHT: movex=0 elif event.key==K_UP: movey=0 elif event.key==K_DOWN: movey=0 #Controls screen.lock() pygame.draw.circle(screen, WHITE, (random.randint(0, 1600), random.randint(0, 1600)), radius) screen.unlock() x+=movex y+=movey #Collision if y < 0: y = 0 elif y > 1080: y = 1080 if x < 0: x = 0 elif x > 1550: x = 1550 #Collision #Dots screen.blit(mouse_c,(x,y)) pygame.display.update()
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!