migrate not migrating(maybe)

32 views
Skip to first unread message

Akuji FooBar

unread,
Oct 21, 2013, 8:30:26 AM10/21/13
to pyglet...@googlegroups.com
Using the Batch migrate method behaves erratically in my code.

What I'm trying to do is to create a very simple fog of war. At the start of the game, everything is hidden(unexplored) and as the player moves around tiles become explored(transparent).

In order to implement this I created a matrix of 5x5 squares(quad_strip) that I migrate to and from 3 different groups depending on whether a tile is visible, explored or unexplored. The visible group sets the color alpha to 0(fully transparent), the explored group set the alpha to 100 and the unexplored group set it to 255.

The problem I have is that, once a group is set, its properties will not disappear after the migration.

Here is the fog code: http://pastebin.com/ZpTkB0ju
If you run it, you should see mostly a black screen(the unexplored area) and a transparent circle close to the bottom left corner(the visible area).

If you uncomment the last two lines of the update_fog function the visible area will disappear and that's what confuses me, because all that line does is migrating the vertexes that already belong to the unexplored_group into the unexplored_group.

What is going on in my code?

"Juan J. Martínez"

unread,
Oct 21, 2013, 8:41:14 AM10/21/13
to pyglet...@googlegroups.com
On 21/10/13 13:30, Akuji FooBar wrote:
> [...]
>
> What is going on in my code?

I can only give your code a quick look but it might be a problem with
FogGroup.

Take a look to the OrderedGroup implementation:

http://code.google.com/p/pyglet/source/browse/pyglet/graphics/__init__.py#690

I think that your group should take the `alpha` prtopery into account in
the same way the OrderedGroup uses `order`.

I'll look at it this evening because your code looks interesting :)

Regards,

Juan

Akuji

unread,
Oct 21, 2013, 9:45:32 AM10/21/13
to pyglet...@googlegroups.com
If I use vertex_list instead of indexed_vertex_list, the code works just fine!



--
You received this message because you are subscribed to a topic in the Google Groups "pyglet-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyglet-users/SVwFnD5wM74/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyglet-users...@googlegroups.com.
To post to this group, send email to pyglet...@googlegroups.com.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages