collision-detection

How to find a turtle collision

How to find a turtle collision Question: I’m trying to make a snake game with turtle in python. What I am trying to do is when the snake goes in the circle the snake gets longer. I’m also trying to make the circle go in a different place every time using the random module and …

Total answers: 1

Adding collision to maze walls

Adding collision to maze walls Question: Can someone please help me adding collision points to my sprites. I had a past code where I layered a bitmap over images but the same code does not integrate well for physically drawing lines rather than detecting where the black/grey is on an image import random import pygame …

Total answers: 1

Detecting collision in Python turtle game

Detecting collision in Python turtle game Question: I am trying to make a Python game where the red turtle chases the blue turtle. When the red turtle catches the blue turtle, I want it to say ‘COLLISION’ on the screen but it is not working. When it collides, nothing happens and it gives me an …

Total answers: 5

How do I detect collision in pygame?

How do I detect collision in pygame? Question: I have made a list of bullets and a list of sprites using the classes below. How do I detect if a bullet collides with a sprite and then delete that sprite and the bullet? #Define the sprite class class Sprite: def __init__(self,x,y, name): self.x=x self.y=y self.image …

Total answers: 5

Why is collide_widget not working here?

Why is collide_widget not working here? Question: I am wondering why my ‘collide_with_hero’ method does not seem to be working? Is there something wrong with my Npcs class? I am just trying to detect when widgets collide (the hero and the tree widget), I stripped out all the additional code in the method, and I …

Total answers: 2

Python Turtle collision with screen boundaries

Python Turtle collision with screen boundaries Question: How do I make the collision? so the turtle/snake doesn’t go out of the box. I’m trying to make them stay inside the (-200, -200) and (200, 200). from turtle import * from random import * def bounding_box(): up() right(90) forward(200) down() left(90) forward(200) left(90) forward(400) left(90) forward(400) …

Total answers: 2