Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Spaceship
Post: RE: Spaceship

When iterating over a list. Then remove item from same list. Will cause next item to be skip in list. Example. Try to remove 2 and 3. But 3 will never get check. mylist = [1, 2, 3, 4, 5] for i in myli...
Windspar Game Development 8 579 May-15-2021, 01:49 PM
    Thread: shooting system in asteroid games
Post: RE: shooting system in asteroid games

Here an example.
Windspar Game Development 1 407 Apr-19-2021, 02:33 AM
    Thread: Textbox is being overdrawn
Post: RE: Textbox is being overdrawn

Here my example.
Windspar Game Development 2 435 Apr-06-2021, 11:59 PM
    Thread: Chopper wash effect efficiency questions.
Post: RE: Chopper wash effect efficiency questions.

Using Vector2 math is low level math. Vector2 will cost less when moving any sprite. Render text is costly. That why I render once every 100 ms. blit any image is fast. That why you save text to a su...
Windspar Game Development 9 1,101 Jan-19-2021, 05:02 PM
    Thread: Chopper wash effect efficiency questions.
Post: RE: Chopper wash effect efficiency questions.

I'm using pygame Vector2 math. My math need more work. Added alot more sparks. But I am still getting no lag. I using wind effect with mouse. Do you get lag when you run my program ? import pygame imp...
Windspar Game Development 9 1,101 Jan-17-2021, 08:05 PM
    Thread: Chopper wash effect efficiency questions.
Post: RE: Chopper wash effect efficiency questions.

I haven't gotten any lag with an emitter yet. Here I clean up code. Still a little rough. import pygame import random class State: def __init__(self, engine): self.engine = engine de...
Windspar Game Development 9 1,101 Jan-14-2021, 07:52 PM
    Thread: Chopper wash effect efficiency questions.
Post: RE: Chopper wash effect efficiency questions.

It really depends on so many factors. How many sparks are alive at one time ? Here my rough example. import pygame import random class State: def __init__(self, engine): self.engine = en...
Windspar Game Development 9 1,101 Jan-14-2021, 08:39 AM
    Thread: Second player on second monitor?
Post: RE: Second player on second monitor?

If you have two different computers. Then you need to learn how to make a server program. Then you would create your client program. Which both computers would have to run client. One would host as th...
Windspar Game Development 2 578 Jan-14-2021, 05:52 AM
    Thread: I have an idea and don't know where to start...
Post: RE: I have an idea and don't know where to start.....

This is what programming is all about. Figure out how to program your code. More you program without copying. The more you will learn. I would use a surface for her name. Then use a rect to color out...
Windspar Game Development 1 531 Jul-25-2020, 06:47 AM
    Thread: Improve performance
Post: RE: Improve performance

Graphics in games are more of an illusion. Realism take to much cpu and gpu power. Create 20+ image frames and rotate through them.
Windspar Game Development 4 704 Jul-04-2020, 09:23 PM
    Thread: Accurate Clicks Per Second
Post: RE: Accurate Clicks Per Second

1. What gui is this for ? Pygame example. Any less 200 millisecond. Probably won't be detected. import os import pygame class Screen: @staticmethod def center(): os.environ['SDL_VIDE...
Windspar Game Development 8 2,155 Jun-13-2020, 09:29 PM
    Thread: Pygame : clearing a screen issue
Post: RE: Pygame : clearing a screen issue

Only have one pygame.display.flip() or pygame.display.update(). Many graphic glitches will happen if you use multiply flips or/and updates. You be forcing an unnatural refresh rate. Which some graphic...
Windspar Game Development 4 1,471 Jun-09-2020, 07:36 PM
    Thread: Getting projectiles into pygame.
Post: RE: Getting projectiles into pygame.

For now just use classes as container. There two level to a class. Class level for a single instance. Objects for multiply instances. Class is a namespace you use to access variables. player_x = 250 p...
Windspar Game Development 5 1,251 May-21-2020, 06:02 PM
    Thread: Pygame lag
Post: RE: Pygame lag

This does not belong in event loop or main loop. TIMER_ID = pygame.USEREVENT + 1 pygame.time.set_timer(TIMER_ID, 1000)You want TIMER_ID as a constant. You want this before you define your variables. W...
Windspar Game Development 6 1,393 May-11-2020, 07:23 PM
    Thread: Issue with item counter
Post: RE: Issue with item counter

1. Don't capitalize variables unless they are constant. Game items will never be a constant. 2. Load your images once. Then you pass your images. They should be in your constant section. Don't forget ...
Windspar Game Development 5 842 May-10-2020, 04:17 PM
    Thread: Pygame lag
Post: RE: Pygame lag

TIMER_ID = pygame.USEREVENT + 1 pygame.time.set_timer(TIMER_ID, 1000) # Then in event loop elif event.type == TIMER_ID: autominer()Object oriented program is not much difference. Then what...
Windspar Game Development 6 1,393 May-09-2020, 04:00 AM
    Thread: Pygame lag
Post: RE: Pygame lag

Yep! time.sleep will cause game to be unresponsiveness. Use a timer for this. Custom events are limited to 32 events. Don't forget to pygame.time.Clock to idle your program. import os import pygame im...
Windspar Game Development 6 1,393 May-08-2020, 09:46 PM
    Thread: Help to fix PYTHON CODES
Post: RE: Help to fix PYTHON CODES

1. You code is hard to read. You also have repeat code. You need rewrite. Don't use time. pygame has it own time module. 2. Import pygame.locals. Instead of using 'Right' use K_RIGHT for direction mo...
Windspar Game Development 2 734 May-06-2020, 03:01 AM
    Thread: help with python mouse clicks and Pygame
Post: RE: help with python mouse clicks and Pygame

This is programming. You can do what ever you put you mind too. So yes. You need to put boolean variable around surface.blit(line_surface, (0, 0). Create show_lines = False before main loop. Then an ...
Windspar Game Development 5 949 May-05-2020, 04:15 PM
    Thread: help with python mouse clicks and Pygame
Post: RE: help with python mouse clicks and Pygame

Never get key pressed in event loop. When in event loop. Only use event items. Example. import pygame def main(): pygame.init() pygame.display.set_caption("Mouse Draw") surface = pygame.d...
Windspar Game Development 5 949 May-04-2020, 02:53 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020