collision

Pygame - Collisions on the sides of a platform [duplicate]

非 Y 不嫁゛ 提交于 2021-02-10 18:43:41
问题 This question already has answers here : How do I detect collision in pygame? (4 answers) How to detect collisions between two rectangular objects or images in pygame (1 answer) Closed 4 days ago . I am currently trying to make my own platformer on pygame . I have coded the collisions for the top and bottom of the platform so that the player can only jump on top of the platform if they are falling onto it. However, if the player walks into the side of the platform, he snaps on top of it. How

Use collidelist in class

点点圈 提交于 2021-02-10 06:13:00
问题 I have created a class to create rectangles and put them in a list . I don't want them to collide so I use collidelist but it isn't working.rectangles are still colliding . I also want rectangles to move down and change x position when hit a specific point , I can do that but I am not sure if it is preventing collidelist from working Look the code below for more clarification. import pygame import random from pygame.locals import * import time pygame.init() a = 255,255,255 b = 0,0,0 c = 80

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

Pygame collision detection, transparent border

半世苍凉 提交于 2021-02-08 10:52:18
问题 For my pygame project, I must detect collision betweeen various .png image that move on the screen. I have put the image inside sprite, and the sprite inside group, then I use this : pygame.sprite.spritecollide(perso, zombie_group, False) However, sometime, my image don't touch, but pygame detect a collision... This is due to the fact that my images are png with transparent borders. The transparent border collide, and pygame detect this :( Any idea to stop the transparent border from

Pygame collision detection, transparent border

北慕城南 提交于 2021-02-08 10:50:38
问题 For my pygame project, I must detect collision betweeen various .png image that move on the screen. I have put the image inside sprite, and the sprite inside group, then I use this : pygame.sprite.spritecollide(perso, zombie_group, False) However, sometime, my image don't touch, but pygame detect a collision... This is due to the fact that my images are png with transparent borders. The transparent border collide, and pygame detect this :( Any idea to stop the transparent border from

Pygame collision detection, transparent border

早过忘川 提交于 2021-02-08 10:49:45
问题 For my pygame project, I must detect collision betweeen various .png image that move on the screen. I have put the image inside sprite, and the sprite inside group, then I use this : pygame.sprite.spritecollide(perso, zombie_group, False) However, sometime, my image don't touch, but pygame detect a collision... This is due to the fact that my images are png with transparent borders. The transparent border collide, and pygame detect this :( Any idea to stop the transparent border from

How to detect collisions with a curve

大憨熊 提交于 2021-02-07 20:15:53
问题 I am making an HTML5 and Javascript platform game. At this moment all blocks of the map are handled as squares. This method is "ugly" when the block is not an exact square/rectangle. Check this image I made to get a better understand of my point: Case one: The "bottom bumper" is touching the square that envolves the block so the movement is stopped. Case two: If I use the same method as above, when the players jumps, the movement will be stopped before the "top bumper" even touches the block.

How to detect collisions with a curve

霸气de小男生 提交于 2021-02-07 20:10:29
问题 I am making an HTML5 and Javascript platform game. At this moment all blocks of the map are handled as squares. This method is "ugly" when the block is not an exact square/rectangle. Check this image I made to get a better understand of my point: Case one: The "bottom bumper" is touching the square that envolves the block so the movement is stopped. Case two: If I use the same method as above, when the players jumps, the movement will be stopped before the "top bumper" even touches the block.

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"/>

WPF Paths Collision detection?

流过昼夜 提交于 2021-02-07 04:11:00
问题 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"/>