Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 02 Mar 2013
Offline Last Active Jun 23 2013 12:03 AM

#5047932 python browser games

Posted by MiniKong on 29 March 2013 - 03:42 AM

I think I'm gonna mess around with Gamejs(its very similar to pygame) and coffeescript. I found this online and coffeescript looks like it could save me a lot of trouble. Iv been messing around with it all night

#5047777 python browser games

Posted by MiniKong on 28 March 2013 - 03:33 PM

i recently finished a game for the blood in the water themed mini ludum dare that i made in pygame. unfortunately pygame is annoying to make exe with so now im not even sure if im gonna upload my game. but that got me thinking is there anyway to upload pygame games to browsers? iv heard about iron python and pyjs which translate python code to java allowing you to make web games and there's another thing called web2py for web dev. .i was planning on just relearnig htm5 and learning some java but now l im thinking about just learning about pyjs or should i go with ironpython instead?

does anyone have any advice or info on the subject.

#5044023 stubborn code

Posted by MiniKong on 17 March 2013 - 01:42 PM

ok i kinda figured out the problem. i decided to add the meteorites to the all_sprites_list< ill use the space_rocks group for collision instead.
its spawning more rocks but when its set to spawn 10 it only spawn like 5 >_<
but when i set rock_number to rock number = 5 * 2 and tell it to spawn the number in rock_number it will then spawn 5 rocks or what ever number i set the multiplied number by. And collision isn't working for the meteorites when I shoot them usually one will disapear and the others aren't affected

#5043913 stubborn code

Posted by MiniKong on 17 March 2013 - 04:22 AM

# IMPORT------------------------------------------
import pygame, sys, random
from pygame.locals import*
# DISPLAY----------------------------------------
screen = pygame.display.set_mode([500,700])
WHITE = (255,255,255)
BLUE  = (  0,  0,255)
class backg(pygame.sprite.Sprite):
    def __init__(self):
        self.image = pygame.image.load('stars.jpg')
        self.image = self.image.convert()
        self.rect = self.image.get_rect()
        self.dy = 5
    def update(self):
        self.rect.bottom += self.dy
        if self.rect.top >= 0:
    def reset(self):
        self.rect.bottom = screen.get_height()
#this is the metorite
rock_speed = 3
class Rock(pygame.sprite.Sprite):
    def __init__(self):
        self.image = pygame.image.load('roid01.png')
        self.rect = self.image.get_rect()
    def reset_pos(self):
        self.rect.x = random.randrange(0,700)
        self.rect.y = 0
    def update(self):
        self.rect.y += rock_speed
        if self.rect.y > 600:
# ACTION------------------------------------------    
      # A - ASSIGN VALUES TO KEY VARIABLES----------------
Stars = backg()
star_list = []
for i in range(100):
    x = random.randrange(0,500)
    y = random.randrange(-100,400)
#this is the metorite
rock_number = 5
for i in range(rock_number):
    srock = Rock()
    srock.rect.x = random.randrange(10,475)
    srock.rect.y = -100
    space_rocks = pygame.sprite.Group(srock)
all_sprites_list = pygame.sprite.Group(Stars)
clock = pygame.time.Clock()
     # L - SET UP MAIN GAME LOOP-------------------------------
done = False
while done == False:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done = True
    # draw background scrolling-------------------------------
    # draw scrolling stars
    for i in range(len(star_list)):
        star_list[i][1] += 15
        if star_list[i][1] > 700:
            y = random.randrange(-50,300)
            star_list[i][1] = y
            x = random.randrange(0,500)
            star_list[i][0] = x
      # T - TIMER TO SET FRAME RATE------------------------
      # R - REFRESH DISPLAY---------------------------------

#5043896 stubborn code

Posted by MiniKong on 17 March 2013 - 01:43 AM

today i decided to do a simple shooter game so i could practice scrolling backgrounds but for some reason code that i use on a regular basis isn't working! my plan was to have the player shoot at/avoid  meteorites unfortunately my code to spawn multiple meteorites is only spawning a single one.iv spent hours trying to fix it.  i event opens a new page and typed up the code for that event but nothing seems to work. iv used similar code for my frogger clone and similar games. can someone please help? im sure its a noob mistake

Attached Files

#5042787 Trigonometry

Posted by MiniKong on 13 March 2013 - 01:04 PM

I've made a few games now such as pong, frogger, duck hunt and a few other clones but now I'm ready to try and make a top down shooter with a scrolling camera ...unfortunately that requires that the player is able to rotate towards the mouse and for that I've been told I need trigonometry :(
Does anyone here know of any tutorials or anything that can help me? I'm using python and pygame. Is their a way for pygame can easly just rotate the objects towards the mouse?

#5040217 Pygame vs blender

Posted by MiniKong on 06 March 2013 - 07:54 PM

I highly recommend that you make 3 to 5 simple 2D games for your first stage of learning.

As examples:

Crossword Puzzle (Can actually get as complex as you want it to be)

Tic Tac Toe (Don't laugh! You can use characters instead of Xs and Os, effects, sounds, etc, etc...make the line be a laser beam! Be creative!)

Pac Man
Donkey Kong
Mario Brothers


so far iv made tic tac toe, asteroids, and a top down shooter. im woking on donkey kong right now, next i plan on making duck hunt but with various animals. iv never thought about doing pokemon though thats a really good idea. thanks for all of the advice