Python Forum
[PyGame] pygame, help with making a function to detect collision between player and enemy.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] pygame, help with making a function to detect collision between player and enemy.
#1
Hi guys.

I am making a game in pygame, where you play as a little spaceship and your mission is to shoot aliens. I am struggling on making a function, when the spaceship hits one of the enemies, i want the game to be game over. I have made a collision function for the missile, when it hits the enemy, the enemy respawn and you get + 1 in score and it works fine, but i am struggling with this.

Hope you can understand my code, but ask if there is any questions. I have used a long time on the game so i hope someone can help me!
Best regards.

Kris.

Here is my code:

https://pastebin.com/5V3d1hTc
Reply


Messages In This Thread
pygame, help with making a function to detect collision between player and enemy. - by Kris1996 - Feb-14-2020, 07:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question [PyGame] Problem with collision of player and enemy Nekotrooper 1 694 Dec-08-2023, 03:29 PM
Last Post: deanhystad
  [PyGame] platformer enemy animation Yegor123 3 2,029 May-03-2023, 08:42 AM
Last Post: Windspar
  player just randomly teleporting to the edge of a platform in pygame BliepMonster 5 2,336 Jan-26-2023, 10:12 PM
Last Post: deanhystad
  can't get collision detection to work in platform game chairmanme0wme0w 10 3,825 Aug-19-2022, 03:51 PM
Last Post: deanhystad
  How to make enemy chase me in pygame? Jan_97 3 4,421 Nov-23-2021, 05:08 PM
Last Post: Jan_97
  [PyGame] Collision in not happening onizuka 3 3,424 Sep-07-2020, 11:30 AM
Last Post: metulburr
  [PyGame] No collision detection onizuka 6 3,677 Aug-18-2020, 01:29 PM
Last Post: onizuka
  Problem with collision detection... michael1789 4 3,282 Nov-12-2019, 07:49 PM
Last Post: michael1789
  Arcade Collision Problem randor 0 2,694 Oct-28-2019, 11:17 PM
Last Post: randor
  Multiple wall collision in pacman rustyjoe 4 4,116 Aug-11-2019, 08:08 AM
Last Post: rustyjoe

Forum Jump:

User Panel Messages

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