collision-detection

Walls in Pygame

眉间皱痕 提交于 2021-02-11 15:19:44
问题 I am trying to make a simple Pac-Man game in Pygame, but I don't know how to make walls. How I can make check if player hit a wall when it moves? This is the code of main.py : # Imports import pygame import sys import player import room # Colors black = (0, 0, 0) white = (255, 255, 255) red = (255, 0, 0) blue = (0, 255, 0) green = (0, 0, 255) # Global variables S_WIDTH = 800 S_HEIGHT = 800 FPS = 60 # player speed SPEED = 2 WALLS = pygame.sprite.Group() # Initialization pygame.init() screen =

Pymunk/Chipmunk2d - dynamic bodies colliding with static bodies generating collsion impulses

∥☆過路亽.° 提交于 2021-02-11 12:40:26
问题 simple question, but couldn't find an answer: Can static bodies apply collision impulses to dynamic bodies? here's a little recording of what my code does As you can see, the two dynamic triangles collide with each other, and are stopped by the static line. however, the behavior is not what I want. If I had only one triangle, it would be skidding down the ledge on just one vertex --> the static body does not inflict any sort of torque or counter forces (I'm no physicist) on the triangles.

Pymunk/Chipmunk2d - dynamic bodies colliding with static bodies generating collsion impulses

北城余情 提交于 2021-02-11 12:39:19
问题 simple question, but couldn't find an answer: Can static bodies apply collision impulses to dynamic bodies? here's a little recording of what my code does As you can see, the two dynamic triangles collide with each other, and are stopped by the static line. however, the behavior is not what I want. If I had only one triangle, it would be skidding down the ledge on just one vertex --> the static body does not inflict any sort of torque or counter forces (I'm no physicist) on the triangles.

why collision between two moving objects on pygame dont work?

耗尽温柔 提交于 2021-02-10 05:13:46
问题 I am doing a snake game(there is two snakes on the game) with pygame and i want to detect when the snake head collides with the another snake body, do that for both and a special case when the both heads collides, im doing currently the collision between the snake head and the other snake body, it works fine if one of the snakes is frozen and the other is moving, but if both is moving the collision just dont work heres the code that moves the snakes: new_pos = None if direction == 'DOWN': new

CircleCollider2D is not registering collisions with some tiles in a TileMapCollider2D

不打扰是莪最后的温柔 提交于 2021-02-08 04:32:52
问题 (I've asked this question over at Unity Answers too, but it can sometimes take a while to get a response there, if I get an answer there I'll put it here too.) I'm making a tile based game that uses Grid > Tilemap with cell layout as Hexagon. The player can move a certain distance based on movement level. My plan is to highlight valid movement spaces in green and invalid in red. To do this I've got a child GameObject called MovementRange that has a CircleCollider2D attached with it's radius

CircleCollider2D is not registering collisions with some tiles in a TileMapCollider2D

爷,独闯天下 提交于 2021-02-08 04:32:31
问题 (I've asked this question over at Unity Answers too, but it can sometimes take a while to get a response there, if I get an answer there I'll put it here too.) I'm making a tile based game that uses Grid > Tilemap with cell layout as Hexagon. The player can move a certain distance based on movement level. My plan is to highlight valid movement spaces in green and invalid in red. To do this I've got a child GameObject called MovementRange that has a CircleCollider2D attached with it's radius

CircleCollider2D is not registering collisions with some tiles in a TileMapCollider2D

自闭症网瘾萝莉.ら 提交于 2021-02-08 04:32:16
问题 (I've asked this question over at Unity Answers too, but it can sometimes take a while to get a response there, if I get an answer there I'll put it here too.) I'm making a tile based game that uses Grid > Tilemap with cell layout as Hexagon. The player can move a certain distance based on movement level. My plan is to highlight valid movement spaces in green and invalid in red. To do this I've got a child GameObject called MovementRange that has a CircleCollider2D attached with it's radius

Collision detection / physics for simple game

风流意气都作罢 提交于 2021-02-07 23:11:21
问题 Hi i am currently working on a mini game for class (first time doing something like this) and i dont really know how to start with collision detection at all. Okay the game i'm creating is a top down sumo fighting game on a icy circular arena where you move around gaining momentum and velocity and try to knock each other off to gain points. So far i have the movement acceleration/friction pretty much down and I also have a system to detect when a collision occurs, i just don't know how to

Collision detection / physics for simple game

江枫思渺然 提交于 2021-02-07 23:01:09
问题 Hi i am currently working on a mini game for class (first time doing something like this) and i dont really know how to start with collision detection at all. Okay the game i'm creating is a top down sumo fighting game on a icy circular arena where you move around gaining momentum and velocity and try to knock each other off to gain points. So far i have the movement acceleration/friction pretty much down and I also have a system to detect when a collision occurs, i just don't know how to

WPF Paths Collision detection?

耗尽温柔 提交于 2021-02-07 04:12:57
问题 I have two hexagon shapes <Path Stroke="Black" HorizontalAlignment="Left" VerticalAlignment="Top" Fill="Red" StrokeThickness="1" Name="Hex1" Canvas.Left="31.343" Canvas.Top="26.866" Height="163.687" Stretch="Fill" Width="159.134" > <Path.Data> <PathGeometry > <PathGeometry.Figures> <PathFigureCollection > <PathFigure StartPoint="43,0"> <PathFigure.Segments> <PathSegmentCollection > <PolyLineSegment Points="43,0"/> <PolyLineSegment Points="86,25"/> <PolyLineSegment Points="86,75"/>