Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: object has no attribute 'add_internal'
Post: RE: object has no attribute 'add_internal'

I have the lines: def __init__(self,ai_game): """Initialise the star and its starting position.""" super().__init__()In my code above so I'm not sure why this is happening.
djwilson0495 Game Development 7 8,063 Feb-25-2021, 04:54 PM
    Thread: object has no attribute 'add_internal'
Post: RE: object has no attribute 'add_internal'

Thanks for your response. I edited my code for the Star class to this: import pygame from pygame.sprite import Sprite class Star(pygame.sprite.Sprite): pygame.sprite.Sprite.__init__(self): ...
djwilson0495 Game Development 7 8,063 Feb-24-2021, 05:01 PM
    Thread: object has no attribute 'add_internal'
Post: object has no attribute 'add_internal'

I'm trying to produce a grid of stars in a pygame window but when I run the code: import sys import pygame # contains functionality to make a game from settings import Settings from star import S...
djwilson0495 Game Development 7 8,063 Feb-23-2021, 02:11 PM
    Thread: drawing images onto pygame window
Post: drawing images onto pygame window

Hi I'm trying to draw a grid of stars onto a pygame screen as a background. The code runs but the pygame window is empty. Here is my code: import sys import pygame # contains functionality to mak...
djwilson0495 Game Development 1 3,481 Feb-22-2021, 10:12 AM
    Thread: Pygame attribute error
Post: RE: Pygame attribute error

Does it not start existing here? self.star = Star(self)
djwilson0495 Game Development 3 3,937 Feb-18-2021, 09:53 AM
    Thread: Pygame attribute error
Post: Pygame attribute error

I'm trying to get a pygame window with a grid of stars. Here's my code: import sys import pygame # contains functionality to make a game from settings import Settings from star import Star class...
djwilson0495 Game Development 3 3,937 Feb-17-2021, 10:02 AM
    Thread: Attribute Error: object has no attribute
Post: RE: Attribute Error: object has no attribute

This is the whole error report: Error:pygame 2.0.0 (SDL 2.0.12, python 3.9.0) Hello from the pygame community. https://www.pygame.org/contribute.html Traceback (most recent call last): File "c:\Use...
djwilson0495 Game Development 3 4,584 Jan-14-2021, 10:50 AM
    Thread: Attribute Error: object has no attribute
Post: Attribute Error: object has no attribute

Hi I'm trying to make a basic game. I'm attempting to have rows of stars as background. This is the code I'm using: import sys import pygame # contains functionality to make a game from settings ...
djwilson0495 Game Development 3 4,584 Jan-13-2021, 11:09 AM
    Thread: rotating an array
Post: rotating an array

I'm trying to write a code to rotate an array by a given value. Here's my code: A = [4,6,8,9,1] K = 2 def rotate_array(A,K): for x in A: y = x + K if y >= len(A): ...
djwilson0495 General Coding Help 3 2,039 Jan-07-2021, 05:01 PM
    Thread: help with finding binary gap
Post: RE: help with finding binary gap

Thanks guys I've got it sorted now. I'm posting my code in case anyone else has a similar issue when trying to do this. N = int(input("Please enter an integer:")) def binary_gap(N): binary = (bi...
djwilson0495 General Coding Help 11 4,394 Jan-05-2021, 04:08 PM
    Thread: help with finding binary gap
Post: help with finding binary gap

Hi I'm trying to write a code to give the biggest gap in a binary number. Here's my code: N = int(input("Please enter an integer:")) def binary_gap(N): binary = str(bin(N))[2:] bin_gap = Fal...
djwilson0495 General Coding Help 11 4,394 Jan-04-2021, 02:34 PM
    Thread: Help with pygame tutorial
Post: RE: Help with pygame tutorial

Thanks everyone, metalburr's answer solved my issue.
djwilson0495 Game Development 10 5,455 Dec-21-2020, 11:28 AM
    Thread: Help with pygame tutorial
Post: RE: Help with pygame tutorial

Sorry I copied my previous code over. The code is currently: import pygame from pygame.locals import * import time class Print: """Draw text to the screen.""" # text is editable with the key...
djwilson0495 Game Development 10 5,455 Dec-15-2020, 04:42 PM
    Thread: Help with pygame tutorial
Post: RE: Help with pygame tutorial

My code is now: import pygame from pygame.locals import * import time class Print: """Draw text to the screen.""" # text is editable with the keyboard # options for font and backgro...
djwilson0495 Game Development 10 5,455 Dec-15-2020, 11:53 AM
    Thread: Help with pygame tutorial
Post: Help with pygame tutorial

I'm trying to make a pygame window where I can enter and edit text. I'm following a tutorial as a base for my code but I'm getting an the following error: Error: File "c:\Users\djwil\Documents\python...
djwilson0495 Game Development 10 5,455 Dec-14-2020, 05:47 PM
    Thread: Rocket will only move in two directions
Post: RE: Rocket will only move in two directions

Thanks that sorted it **smile**
djwilson0495 Game Development 7 3,777 Dec-14-2020, 05:43 PM
    Thread: Rocket will only move in two directions
Post: RE: Rocket will only move in two directions

I've just tried what your suggesting and I get this error : Error:File "c:\Users\djwil\Documents\python\python crash course\Projects\Alien invasion\rocket3.py", line 43, in check_keydown_events i...
djwilson0495 Game Development 7 3,777 Dec-10-2020, 05:27 PM
    Thread: Rocket will only move in two directions
Post: RE: Rocket will only move in two directions

Thanks I will try that but is there anything else wrong with my code that you can see? I don't want to repeat errors later on.
djwilson0495 Game Development 7 3,777 Dec-10-2020, 09:12 AM
    Thread: Rocket will only move in two directions
Post: Rocket will only move in two directions

I'm trying to make a simple game where a rocket can move in 4 directions. however currently it only moves left and right even when pressing the up or down keys. Can someone tell me why this is happeni...
djwilson0495 Game Development 7 3,777 Dec-09-2020, 05:52 PM
    Thread: Getting a ship to move in pygame
Post: RE: Getting a ship to move in pygame

Thank you that solved it. **smile**
djwilson0495 Game Development 2 3,612 Dec-09-2020, 11:03 AM

User Panel Messages

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