Hi Claudio, Thanks for your answer. It's been very helpful. The idea of drawing the background to red is a nice trick. I didn't think about it. :)
But as you suggested in the last part of your answer, I will probably make another layer with the grid which will come on top of the tilemap. Or I might just add this grid to the batch of the tilemap with a greater z value. I will draw this grid using primitive opengl figures: red quads with no opacity, and some lines to draw the borders. Then when I want to highlight a square, I change the quad opacity and this should do the trick now, I think. I've already made the grid, but haven't tried yet to have the tilemap underneath. I have one more question. In various tests, I see that the Layer has: self.schedule( lambda x: 0 ) I don't understand why that is. I tried to remove it and saw the FPS dropping dramatically. Would you be so kind to explain this one? Thanks again, Dan. Le jeudi 1 août 2013 22:33:18 UTC+2, Daniel Gillet a écrit : > > Hello, > > First post for me and I'm still learning Cocos2d. So bear with me. > > I played a bit with test_tmx.py. I added this code > > def on_key_press(key, modifier): > if key == pyglet.window.key.Z: > if scroller.scale == .75: > scroller.do(actions.ScaleTo(1, 2)) > else: > scroller.do(actions.ScaleTo(.75, 2)) > elif key == pyglet.window.key.D: > test_layer.set_debug(True) > elif key == pyglet.window.key.F: > test_layer.set_cell_color(0, 0, (255, 0, 0) ) > > I notice that this colorize indeed first cell (bottom left), but the black > region is still black. This seems to make sense as the colors are > multiplied, if I understood correctly. What should I change if I would like > to have a reddish hue on this cell. The idea is to highlight some cells > with a color, so the player can know where he can move for instance. > > Also in this demo, when I use the scaling to 0.75, we see black lines from > the grid while the car is moving. Is there something I could do to minimize > this problem? > > And last question, if my intention was to draw a grid, how should I > proceed? Of course I could add another layer with its own grid, but I feel > like it's unnecessary duplication. The vertex are already there. Can we > still show the quads border while using textures? > > Thanks for your help, > Dan. > -- You received this message because you are subscribed to the Google Groups "cocos2d discuss" 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 http://groups.google.com/group/cocos-discuss. For more options, visit https://groups.google.com/groups/opt_out.
