Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
breakout clone pygame
#1
Hello,
I'm trying to program a breakout clone.

With lives = ball.move(lives) I'm trying to send "lives" to the move method of Ball.

But an error occurs:

Traceback (most recent call last):
File "D:/Daten/Breakout-neu/main.py", line 89, in <module>
main()
File "D:/Daten/Breakout-neu/main.py", line 45, in main
lives = ball.move(lives)
File "D:\Daten\Breakout-neu\ball.py", line 43, in move
lives -= 1
TypeError: unsupported operand type(s) for -=: 'NoneType' and 'int'

What I'm doing wrong?
-----------------------------------------------
Moreover:
Do I have to add a bounce method to Ball?
I tried:

if ball.collpaddle(paddlegroup):
ball.dy *= -1
-----------------------------------------
I'm politely asking for help...
Please be so kind an help me...

(main and Ball is attached as text files)

Attached Files

.txt   ball.txt (Size: 1.45 KB / Downloads: 188)
.txt   main.txt (Size: 3 KB / Downloads: 175)
Reply


Messages In This Thread
breakout clone pygame - by flash77 - Feb-06-2022, 06:46 AM
RE: breakout clone pygame - by metulburr - Feb-06-2022, 10:22 AM
RE: breakout clone pygame - by flash77 - Feb-06-2022, 06:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  breakout clone flash77 32 8,584 Mar-07-2022, 08:12 PM
Last Post: deanhystad
  [PyGame] arkanoid / breakout clone flash77 2 4,096 Feb-04-2022, 05:42 PM
Last Post: flash77

Forum Jump:

User Panel Messages

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