Python Forum
Randomly selecting sprite from group?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Randomly selecting sprite from group?
#3
I need to use coordinates that are in my "Floor_tiles" sprite.Group so items don't appear on the stairs, in the wall, or outside the walls where the character can't go. And all these change every time because it is a map made by random walk. It's not a square grid.

Do sprite groups have an index that I can somehow random choice from?

It occurs to me now that I might be able add the floor sprite's coordinates to a dictionary(or list, or something) as they are put down and then select from that list. Haven't done much of this stuff yet.
Reply


Messages In This Thread
RE: Randomly selecting sprite from group? - by michael1789 - Nov-13-2019, 11:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] Sprites just randomly appear and dissapear in my pygame.sprite.GoupeSingle trueShadoWrr 2 2,148 Feb-13-2023, 09:34 AM
Last Post: Vadanane
  player just randomly teleporting to the edge of a platform in pygame BliepMonster 5 2,533 Jan-26-2023, 10:12 PM
Last Post: deanhystad
  [PyGame] Sprite image.get_rect() moves sprite to 0, 0 michael1789 2 4,710 Dec-13-2019, 08:37 PM
Last Post: michael1789
  Sprite not rendering Clunk_Head 2 2,272 Oct-03-2019, 11:27 AM
Last Post: Clunk_Head
  Need help making a sprite GalaxyCoyote 4 3,388 Aug-11-2019, 09:12 PM
Last Post: metulburr
  moving a sprite pfaber11 3 2,688 May-15-2019, 12:52 PM
Last Post: pfaber11
  [PyGame] Need Help With Sprite ghost0fkarma 2 3,372 Jan-09-2018, 02:14 PM
Last Post: ghost0fkarma
  [PyGame] move randomly sprites reutB 4 8,402 Mar-29-2017, 01:12 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

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