The "subjects" layer is built manually:
def get_subjects_layer(self) -> cocos.tiles.RectMapLayer:
# TODO: hardcoded values: use TMX infos
cells = self.generate_subjects_cells(width=70, height=40, tile_width=8, tile_height=8)
return cocos.tiles.RectMapLayer(
id='subject',
tw=8, # hardcoded values: use TMX infos
th=8, # hardcoded values: use TMX infos
cells=cells,
)
def generate_subjects_cells(
self,
width: int,
height: int,
tile_width: int,
tile_height: int,
) -> typing.List[typing.List[cocos.tiles.RectCell]]:
cells = [[None] * height for x in range(width)] # type: typing.List[typing.List[cocos.tiles.RectCell]]
for n in range(width * height):
i = n % width
j = height - (n // width + 1)
# TODO: Give here the tile
cells[i][j] = cocos.tiles.RectCell(i, j, tile_width, tile_height, properties={}, tile=None)
return cellsRegards,
Bux.
--
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 cocos-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to cocos-...@googlegroups.com.
Visit this group at https://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/d/optout.
Hi,
My intent is the number two: add actors who will move on a grid specified in the tmx file. I thought RectMapLayer can help me about that with this "grid" management and functions like get_at_pixel/get_in_region (to select actor with click for example).
Final goal is to make an interface like Close Combat series game:

You received this message because you are subscribed to a topic in the Google Groups "cocos2d discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cocos-discuss/WOdnOu_7y44/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cocos-discus...@googlegroups.com.
Hi,
My intent is the number two: add actors who will move on a grid specified in the tmx file.
I thought RectMapLayer can help me about that with this "grid" management and functions like get_at_pixel/get_in_region (to select actor with click for example).
To unsubscribe from this group and all its topics, send an email to cocos-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to cocos-...@googlegroups.com.
Visit this group at https://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/d/optout.
Hi,
Thank's for these informations. I will take a look about all of that and go back here or in new thread if questions appears.
Thank's again,
Bux.
To unsubscribe from this group and all its topics, send an email to cocos-discus...@googlegroups.com.
Hello,
I'm tring to reproduce (copy-paste mouse_elastic_box_selection.py) the MinMaxRect and ProbeQuad. ProbeQuad is working, but MinMaxRect is not visible. When i debug/look at logs, python correctly enter in begin_drag, adjust_elastic_box, etc functions. But rectangle selection is not visible.
I hope it will be not to much difficult to enter in my code, but to reproduce:
Setup commands:
Run the script:git clone https://github.com/buxx/synergine2.git test_bux_cocos
cd test_bux_cocos/
git checkout tile
virtualenv --no-site-packages -p /usr/bin/python3.5 venv3.5
source venv3.5/bin/activate
pip install -r requirements.txt
python sandbox/tiledstrategy/run.py maps/003You should see a top view map, with some trees and some actors moving. ProbeQuad is visible under mouse. When click, drag and move, terminal who run command print the following log:
begin dragBut no rectangle appear.
begin drag selection: drag_selecting, drag_moving True False
Hello,
Thank for your investigation. Actually it was not a strategy to present a setup commands list to "hide" code complexity. Sorry for that, be sure i will make only small script in future.
In addition of that my error was terribly simple (missing the method draw) even if I spent hours to debug ...
Thank you again.
Bux.
You received this message because you are subscribed to a topic in the Google Groups "cocos2d discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cocos-discuss/WOdnOu_7y44/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cocos-discus...@googlegroups.com.