Skip to main content
Clarified. Retitled to match better.
Source Link
Anko
  • 13.5k
  • 10
  • 56
  • 82

Getting collision Collision detection without classes, in PygamesPygame

I am writing a game in Pygame, I and want to get collision detection working. The aim is that when aan object hits another, the target object disappears. I want to avoid having classes and just have my code class less for now, in one scriptto keep things simple. This makes it difficult to get collision detection working, because the RectRect method in Pygame is called on by an object(class)assumes classes.

The logic I want to achieve is:

object hits a target object

target object disappears.

if object hits a target object
    target object disappears

is there an easy wayWhat's the minimal code I'd need to achieve this?(with minimal code possible)

Getting collision detection in Pygames

I am writing a game in Pygame, I want to get collision detection. The aim is when a object hits another, the target object disappears. I want to avoid having classes and just have my code class less for now, in one script. This makes it difficult to get collision detection because the Rect method in Pygame is called on by an object(class).

The logic I want to achieve is:

object hits a target object

target object disappears.

is there an easy way to achieve this?(with minimal code possible)

Collision detection without classes, in Pygame

I am writing a game in Pygame and want to get collision detection working. The aim is that when an object hits another, the target object disappears. I want to avoid having classes for now, to keep things simple. This makes it difficult to get collision detection working, because the Rect method in Pygame assumes classes.

The logic I want to achieve is:

if object hits a target object
    target object disappears

What's the minimal code I'd need to achieve this?

Source Link

Getting collision detection in Pygames

I am writing a game in Pygame, I want to get collision detection. The aim is when a object hits another, the target object disappears. I want to avoid having classes and just have my code class less for now, in one script. This makes it difficult to get collision detection because the Rect method in Pygame is called on by an object(class).

The logic I want to achieve is:

object hits a target object

target object disappears.

is there an easy way to achieve this?(with minimal code possible)