Python Forum
Need help figuring out Sprite.Group Collision code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help figuring out Sprite.Group Collision code
#3
Sorry I wasn't clear.
Let me repeat the main part:


Question: How do I make it so when a "cell" object from spr_cell_group hits a "plant" object from spr_plant_group, the plant and cell in the individual collision are referenced correctly and the 'food' is provided from THAT plant to THAT cell ?



I basically want to check:

IF a cell hits a plant, feed the cell the plant.food value. Kill the plant.

What's happening is as I found out, the code is somehow returning the cell's own food and the result is the cell's .food rises exponentially (instead of eating 20 food, it's eating, 100 whatever it has left, at the time of collision).
Reply


Messages In This Thread
RE: Need help figuring out Sprite.Group Collision code - by PySam - Sep-14-2017, 03:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Star I was making code for collision for my character izmamonke 2 2,126 Aug-06-2021, 04:30 PM
Last Post: izmamonke
  SOLVED - Collision detection - TURTLE OuateDePhoque 9 11,607 Nov-18-2020, 06:29 PM
Last Post: OuateDePhoque
  bouncing ball with variable collision points (in time) Zhaleh 1 2,417 Jul-24-2020, 02:54 PM
Last Post: Marbelous
  Player object wont recognize collision with other objects. Jan_97 3 2,769 Dec-22-2019, 04:08 PM
Last Post: joe_momma
  Help figuring out why I can't install pygame Skeleton_Warrior 4 13,179 Oct-20-2019, 10:02 PM
Last Post: Skeleton_Warrior
  Collision function problem jtstewart95 2 2,814 May-02-2018, 11:44 PM
Last Post: scidam
  Union of dictionaries (taking max value on collision) meee 5 3,851 Jan-17-2018, 09:14 PM
Last Post: Mekire

Forum Jump:

User Panel Messages

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