Changing a Batch is "expensive", but unless you're doing it for hundreds of 
Sprites at once you probably won't notice it. You mainly just want to avoid 
doing this every frame. Doing it between levels, or at loading points, is 
perfectly fine. 

If your player class is fairly complex and contains a lot of state, it's 
easy enough to just update it's Batch and keep the same instance. It's 
really just preference though. You can also have a seperate Batch entirely 
for things like the HUD, and just draw both Batches each frame. This works 
fine, if it's OK that the entire second Batch is drawn on top (such as a 
HUD). If your player will need to go underneith other sprites in the scene, 
then you're better using the OrderedGroups inside of the same Batch. 

Sounds like a pretty interesting game concept. I suppose the player would 
need to be able to bail out of a room in case they get stuck, or don't have 
the right power yet?
Pretty cool. Looking forward to seeing this at some point. 


On Tuesday, June 19, 2018 at 3:46:36 AM UTC+9, Mindok wrote:
>
> Thanks for your reply Ben!
> I was reading about Batches and that changing them is expensive, so I was 
> starting to lean in the direction of #2.
> But it is a good thing to get confirmation!
> Is it still reasonable to change the player sprite's batch from old level 
> to new when transitioning between levels?
> Is there a performance difference between changing the sprite's batch and 
> destroying the sprite in the old level (batch) and creating a new sprite in 
> the new level (batch)?
>
> I'm trying to make a Sokoban style game that has free exploration of the 
> game rather than linear progression of stages with puzzles.
> So most of the time the player has more than one puzzle that they can 
> solve to progress in the game.
> The game is divided between levels/rooms, and the player can move between 
> them.
> There is a mechanic in the game that makes it like 'Sokoban Metroidvania', 
> as in you will gain powers that will help you progress in other parts of 
> the game.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to