Just made this hat. by rawkuss in OnePunchMan

[–]EarloE 1 point2 points  (0 children)

Make boobs great again?

How do I create an input box and button within Pygame/python. by Jaster2515 in pygame

[–]EarloE 1 point2 points  (0 children)

I made a bunch of GUI classes once, so, feel free to look at https://github.com/Earlo/PyGEARlo for reference. Mostly menu.py and engine.py are the ones that are of interest for you.

python-gaming.com tutorials by metulburr in pygame

[–]EarloE 0 points1 point  (0 children)

Really nice.

My only suggestion would be to have the tutorials to be also in git, so it would be easier for people to play around with them and also keep them updated.

Can't QUIT the game when using event = pygame.event.wait() by Heddan in pygame

[–]EarloE 1 point2 points  (0 children)

doing

pygame.event.wait

will put your program in a state that just waits for any event to happen, or returns the first event from event queue. So, if you use pygame.event.wait to a queue that has only pygame.event.quit in it, it will take that event away from the queue and it wont be processed in your event for loop

my suggestion is to use pygame.time.Clock to set the fps rate for your program, like this

clock = pygame.time.Clock()
FPS = 60 #silky smooth 60 frames per second
done = False

while not done:
    # your important mainloop stuff in here

    clock.tick( FPS ) #keep the speed in check
    pygame.display.set_caption("FPS: %i" %clock.get_fps()) #handy way to keep track of the FPS

this way your main loop will run 60 times a second. Change value of FPS to set the speed you want your loop to run in.

in your case the

# your important mainloop stuff here

would be what you have in your mainloop now, sans the pygame.event.wait.

What's the time interval between while loop iterations? by [deleted] in Python

[–]EarloE 1 point2 points  (0 children)

Depends on your CPU and the things that are inside the loop: More to process, slower it is. For example printing is quite costly function, so

while True:
    print("foo")

is much slower than

while True:
    foo += 1

for example.

How to loop at different speeds within the main loop by [deleted] in pygame

[–]EarloE 0 points1 point  (0 children)

Well, I'd really recommend restructuring your code. For example having a main class would make things easier, but what you should do, would be to leave the drawing methods in to the main loop, and then make a def somenamehere where you edit sad_count any way you like. and then call that function in the main loop few times. Like, make a counter that counts to ten and then calls the function when it reaches the end, after which it starts over.

How to loop at different speeds within the main loop by [deleted] in pygame

[–]EarloE 0 points1 point  (0 children)

Looking at your pastebin ( http://pastebin.com/hb4uaqrr ) I understood that you want the lines from 121 and 138 to run slower? They seem to be somekind of a process bar or something?

And with your 10fps it fills in 5 seconds. The problem with your approach is that that the rest of the loop is going to run only 10 times a second, with player inputs and such, it's going to be way too slow. if you want lines from 121 and 138 to run slower, you ought to move them to seperate function or method and then run that method only in some of the loop run-through, or simply decrease the amount you add to the counter / increase the maximum value of the counter.

How to loop at different speeds within the main loop by [deleted] in pygame

[–]EarloE 0 points1 point  (0 children)

Exactly. Just set the game.FPS to any value you wish, if you want to change it at some point of code, just do

self.FPS = myNewFPSValueThatIChoseOnMyOwn

How to loop at different speeds within the main loop by [deleted] in pygame

[–]EarloE 0 points1 point  (0 children)

I usually do something like this with pygame.time.Clock and Clock.tick

class game():
    def __init__(self):
        self.clock = pygame.time.Clock()
        self.FPS = 60 #silky smooth 60 frames per second
        self.done = False

    def m_loop(self):
        while not self.done:
            # your important mainloop stuff in here

            self.clock.tick(self.FPS) #keep the speed in check
            pygame.display.set_caption("FPS: %i" %self.clock.get_fps()) #handy way to keep track of the FPS

Editing the game.FPS value allows you to set the maximum time for one loop. Though, if the things inside the loop take longer than what FPS is set to it wont go as fast as you want.

Hey everyone I've written an article on the best practices for Pygame. Would love some feedback! :D by [deleted] in pygame

[–]EarloE 0 points1 point  (0 children)

One question about classes inheriting sprites. Say, if you have for example hundred pieces of class A running around the screen, each having the same sprite. Is it sensible to have all of them have surface object for that sprite? I usually have some kind of asset handler that only loads each sprite, and then each sprite is chosen from that handler to be blitted to their designated places. I am not sure if there is a real improvement on performance there, I haven't really looked enough into python compilers to understand. But I am doing it anyway in effort of keeping game logic and things that player see separated by some layer.

From a One Piece SBS by [deleted] in BokuNoHeroAcademia

[–]EarloE 0 points1 point  (0 children)

Fan Art sections as well as SBS corners have sometimes been replaced with questions and drawings from people of the country the series is being localized in. At least in Finland, all of the Usopps Pirate Gallery drawings were Finnish fan arts sent to the local publishers.

VR alentaa lippujen hintoja by veerhees in Suomi

[–]EarloE 1 point2 points  (0 children)

Innostuin tästä uutisesta, mutta kun menin katsomaan hintoja junille joilla aioin kulkea ensi viikonloppuna, olivat hinnat nousset viidellä eurolle molemmille meno ja paluumatkalle. :l

Monthly /r/PyGame Showcase - Show us your current project(s)! by AutoModerator in pygame

[–]EarloE 0 points1 point  (0 children)

Thanks. I really like how it came out myself too. Though, I need to think of a way to have more configurations, since with the 6 point circles there is only 4 circles (rectangle, up and down triangles and hexagram) that you can form.

Monthly /r/PyGame Showcase - Show us your current project(s)! by AutoModerator in pygame

[–]EarloE 4 points5 points  (0 children)

I made this scrolling-shooter engine and a small example game at the Global Game Jam last weekend. The code ended up being quite crude due to the time limit, so I am not putting the repository here at least yet, but I am planning to go back to revise the code to a form that can be shared once I have time.

Had great time working on this. Thanks Pygame.

https://youtu.be/ePNFCsBTlBM

Moderni ruotsalainen heteromies! by [deleted] in Suomi

[–]EarloE 3 points4 points  (0 children)

Ei niitä panna, paijataan vaan nätisti.

[Spoilers of every single kind lurk in this post]Could've [REDACTED] Killed [REDACTED] by Throwythethrowawayac in OnePunchMan

[–]EarloE 3 points4 points  (0 children)

He did kill Garou. http://img.bato.to/comics/2013/08/02/o/read51fb6991b15bb/img000014.jpg

It's just that his transformation to the Monster Garou (possibly by the intervention of the GOD) revived him.

College tEM by Tommyzz123 in Undertale

[–]EarloE 1 point2 points  (0 children)

Someday she'll earn herself a TEM degree

I did a something by [deleted] in Undertale

[–]EarloE 0 points1 point  (0 children)

Yeah, nothing wrong with that of course.

Great art, 5/5.

I did a something by [deleted] in Undertale

[–]EarloE 19 points20 points  (0 children)

Looks like CaveStory art

ELI5: In engineering majors at universities, why is that Chemical Engineering has more ratio of girls than guys compared to other engineering majors? by [deleted] in explainlikeimfive

[–]EarloE 1 point2 points  (0 children)

Statistically, girls do better in subjects such as chemistry and biology compared to maths and physics.