Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: what's not working? black window
Post: RE: what's not working? black window

You never told anything to draw to screen. You only need one pygame.display.update or pygame.display.flip. I always recommend flip over update. Until you learn how to use update. Flip will be faster a...
Windspar Game Development 3 812 Nov-16-2023, 05:56 AM
    Thread: pygame, sprites, and rects
Post: RE: pygame, sprites, and rects

That at best. There also so many other factors. Like when computer running other programs. When code has to do a lot of calculating. No program can guarantee fps. Pygame clock will idle fps down to 60...
Windspar Game Development 12 1,957 Nov-02-2023, 12:52 AM
    Thread: pygame, sprites, and rects
Post: RE: pygame, sprites, and rects

You probably don't know what side effects it will cause. If you had more events trigger. You would notice lag on input.
Windspar Game Development 12 1,957 Nov-01-2023, 03:23 AM
    Thread: pygame, sprites, and rects
Post: RE: pygame, sprites, and rects

Why are you using pygame.event.poll ? That does 1 event per frame. This will give you unwanted side effects. running = True while running: # Event Loop for event in pygame.event.get(): ...
Windspar Game Development 12 1,957 Oct-31-2023, 06:53 AM
    Thread: pygame, sprites, and rects
Post: RE: pygame, sprites, and rects

(Oct-25-2023, 04:25 AM)menator01 Wrote: Taking the following snippet, is it possible to create a pygame.Rect() and add it to a sprite group? Been looking for awhile and not really found anything. Ma...
Windspar Game Development 12 1,957 Oct-25-2023, 08:09 PM
    Thread: Syntaxt error part 2
Post: RE: Syntaxt error part 2

You just posted this in your original post. Since you are still attacking the same problem. Are you just typing this in to idle ? Show error. It tells you where to look. You still need double undersc...
Windspar Game Development 2 1,315 Jun-12-2023, 06:25 PM
    Thread: Pygame in 90 Minutes - For Beginners syntax issues
Post: RE: Pygame in 90 Minutes - For Beginners syntax is...

Just a few typos. This is mainly use for testing. # It double underscore. if __name__ == '__main__': # It lower case main to match your function. main()Example import pygame def main(): #...
Windspar Game Development 6 2,548 Jun-08-2023, 07:38 AM
    Thread: Surface and rectangle in pygame
Post: RE: Surface and rectangle in pygame

(May-14-2023, 01:53 PM)Fabrizio_fg Wrote: but when i have to move the object we move only the rectangle, what it means? We move only the rectangle, and the surface? Remain in the original position? ...
Windspar Game Development 6 2,346 May-15-2023, 08:36 PM
    Thread: Problem with colorkey
Post: RE: Problem with colorkey

Converting the image first. Then set colorkey. You don't add colorkey to screen. Also you need to refresh screen. It also better to use a path tool for joining paths. It makes it more portable. from ...
Windspar Game Development 4 1,886 May-15-2023, 08:22 PM
    Thread: platformer enemy animation
Post: RE: platformer enemy animation

Tips. 1. You do not want to load images in sprite class. This will load the image again making another copy in memory. 2. Convert your images. Otherwise pygame will do this every turn. If it needs too...
Windspar Game Development 3 2,025 May-03-2023, 08:42 AM
    Thread: Zooming on mouse position calculation
Post: RE: Zooming on mouse position calculation

Example. Still needs a little work. import pygame class Zoom: def __init__(self, area, speed, image): # Multiply by 2 for smooth rect inflate. self.speed = speed * 2 self....
Windspar Game Development 1 2,157 Jan-01-2023, 03:55 AM
    Thread: Pygame Help
Post: RE: Pygame Help

Edit: Just realize this is an old thread. Maybe this will give you some idea. Haven't done score card yet. import pygame import random from itertools import count from pygame.sprite import Group, Spr...
Windspar Game Development 6 3,707 Nov-25-2022, 03:14 AM
    Thread: Tips on Converting BASIC to Pygame
Post: RE: Tips on Converting BASIC to Pygame

First. You only want one main loop. Have it waiting as loop is not good. Look at fourth tip. Second. Pygame has many predefine colors. Just use strings. "white", "black" import pygame for color in li...
Windspar Game Development 4 2,457 Oct-06-2022, 08:14 AM
    Thread: finding local area in dictionary
Post: RE: finding local area in dictionary

key in dict -> return bool
Windspar Game Development 3 2,224 Sep-02-2022, 03:10 AM
    Thread: Text stacking on top of one another
Post: RE: Text stacking on top of one another

Anchor in my code. Is using pygame rect position. "topleft", "midleft", "center", so on. Here a more functional example. import pygame from pygame.sprite import Group, Sprite from itertools import cou...
Windspar Game Development 5 2,014 Aug-30-2022, 12:42 AM
    Thread: Text stacking on top of one another
Post: RE: Text stacking on top of one another

I always try to avoid global. I keep refactoring my code to the smallest part. I always go for flexibility. Example import pygame from pygame.sprite import Group, Sprite from itertools import count c...
Windspar Game Development 5 2,014 Aug-29-2022, 05:24 PM
    Thread: how to use mouse to locate pixel co-ordinates
Post: RE: how to use mouse to locate pixel co-ordinates

With pygame events you can do this. for event in pygame.event.get() if event.type == pygame.MOUSEBUTTONDOWN: if event.button == 1: print(event.pos)
Windspar Game Development 4 2,181 Aug-09-2022, 10:51 PM
    Thread: Laggy Game Movement
Post: RE: Laggy Game Movement

Here an example. I haven't finish it. Just let me know if this lag. If this doesn't lag. Then something in your code is causing it. import pygame import random # Why make frameworks. For you can use ...
Windspar Game Development 12 4,377 Jul-27-2022, 08:14 PM
    Thread: Laggy Game Movement
Post: RE: Laggy Game Movement

Delta is the time between pygame.display.flip. Since fps can and will vary. This is why you use pygame.time.Clock. The clock.tick will always return in millisecond. You can simple * 0.001 to return in...
Windspar Game Development 12 4,377 Jul-20-2022, 02:54 AM
    Thread: Laggy Game Movement
Post: RE: Laggy Game Movement

By using pygame.time.get_ticks. This is how I normal handle it. This handle three different ways. one shot timer, repeat timer, and trip counter timer. class Ticker: def __init__(self, ticks, inte...
Windspar Game Development 12 4,377 Jul-20-2022, 02:37 AM

User Panel Messages

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