Python Forum
[PyGame] 2D BoardGame Pygame
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] 2D BoardGame Pygame
#5
(Aug-13-2019, 11:59 AM)Josh_Python890 Wrote: The main black grid I want to be infinitely big i.e. the player can drag it around.
This wouldn't be too hard. You can make a class of grids like Windspar has shown above. When the player moves over to the right to see more cells, just move all the cells to the left. You can have a list of all the cells and go through and draw all the cells from the list. Now the problem with this is that you'll eventually have too many cells to draw and the lag will be crazy. So we only want to draw a cell if it is visible. Before drawing a cell the program can check if the cell is visible, if not there is no point in drawing the cell. You'd also have to apply this same concept to the cards. Even doing this, there could be lag if they build up like 100 cells on the list. To counter this, you can put cells in a different list when they are not visible. When the player explores to a new area, check if any of the cells in that list are in the new area, if so then put them back in the list, otherwise of none of the cells in that list are in the new area, juts create a new cell. I hope this helps with your problem of making an infinite board!
Reply


Messages In This Thread
2D BoardGame Pygame - by Josh_Python890 - Aug-13-2019, 11:59 AM
RE: 2D BoardGame Pygame - by metulburr - Aug-13-2019, 12:32 PM
RE: 2D BoardGame Pygame - by Windspar - Aug-13-2019, 02:18 PM
RE: 2D BoardGame Pygame - by Windspar - Aug-13-2019, 06:25 PM
RE: 2D BoardGame Pygame - by SheeppOSU - Aug-14-2019, 02:32 AM
RE: 2D BoardGame Pygame - by Windspar - Aug-15-2019, 09:02 PM

Forum Jump:

User Panel Messages

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