Mekire's Profile User Rating: -----

Reputation: 118 Stalwart
Active Members
Active Posts:
218 (0.18 per day)
11-January 13
Profile Views:
Last Active:
User is offline Feb 15 2015 12:53 PM

Previous Fields

Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
Icon   Mekire has not set their status

Posts I've Made

  1. In Topic: Rotate imge in pygame.

    Posted 15 Feb 2015

    The black rectangle is caused by incorrectly converting your image. It either needs to be converted with convert_alpha() or have a specific color set as a colorkey and converted with convert().

    For collision, if you want pixel perfect collision then you basically have two options:
    1) Use mask collision. This would probably be perfectly fine for your needs, but can be a bit resource intensive if you are doing it with too many objects.
    2) Use a prebuilt physics engine (pymunk, box2d, etc.)

  2. In Topic: pygame tkinter mouse freezing

    Posted 16 Dec 2014

    Although it is possible to use pygame and tkinter together, they really don't play nicely. If you are just trying to get user text input you would be better off just using pygame.

    If you are set on using tkinter, please supply a short runnable example that recreates your problem and I'll see if I can help.

  3. In Topic: 'click' event in pygame isn't working

    Posted 14 Dec 2014

    I don't much like pygbutton (nor should you expect pygame programmers to use or even be aware of it) but anyway.

    This is a minimal example that shows that the button is working as expected.
    Does this work for you?

    import sys
    import pygame as pg
    import pygbutton
    screen = pg.display.set_mode((500,500))
    clock = pg.time.Clock()
    button = pygbutton.PygButton((200, 200, 100, 30), "Register")
    done = False
    while not done:
        for event in pg.event.get():
            if event.type == pg.QUIT:
                done = True
            elif 'click' in button.handleEvent(event):
                print("Button pressed.")
  4. In Topic: Need help implementing a health bar to my game (PYGAME)

    Posted 28 Nov 2014

    There are a couple things here that may prevent you from getting assistance.
    You haven't provided any of the graphics which your program relies on.
    You are also using some modules that are not a standard part of pygame.
    People need to be able to run your program in order to provide assistance.

    Also, I know you don't want to hear this but, it is either time to go learn about classes; or at the very least, time to learn how to write good functions. When you stuff so much in a single function you completely defeat the point of even having one. You have probably heard, "don't use global variables," before. Well, when you have large functions you are still using global variables. If I put a function around my entire program it isn't avoiding any of the issues that you would have if they were actually global.

    If you can get a runnable example up (most preferably in git repo form) I will try and work with the code you have. But, you are going to hit a point very soon where your program is just too complex and convoluted to continue with this approach. I think your time would be better served by stepping back and learning about classes.

    You can find some basic pygame examples that use classes in my repo here:
    My pygame samples.
    If you start with this one you can see what a really simple pygame with classes would look like:
    Color change.
    Specifically note the length of each function.

  5. In Topic: Structure of a game - pygame

    Posted 2 Jul 2014

    To cleanly implement a game with multiple scenes you will need some sort of scene manager. This can be implemented as a FSM or PDA, but knowing about that isn't really critical at this point.

    Here is a fairly bare bones scene manager example:
    Be aware that this is probably quite a jump from your current level.

    As for your current code, I still think you need to really get yourself used to how rects work. Play around with them in the interactive interpreter until you are really comfortable with them. Understanding them really is key to working with pygame. Also I'm not sure why you are defining your classes inside another function. Typically the only time you would do this would be if the function was a class factory, and in your case it is not. Also, you should work on getting your main loop out of the global namespace.


My Information

Member Title:
D.I.C Head
Age Unknown
Birthday Unknown
Amakusa, Japan

Contact Information



Page 1 of 1
  1. Photo

    RetroGamer Icon

    13 Dec 2013 - 10:48
    Thanks man for the help awesome work!
Page 1 of 1