UIEntityCollectionIter - enable looping over Grid.entities #26

Closed
opened 2024-03-09 18:57:46 +00:00 by john · 1 comment
Owner

31 feat: UIEntityCollectionIter - enable looping over Grid.entities

31 feat: UIEntityCollectionIter - enable looping over Grid.entities
john added the
Tiny Feature
label 2024-03-09 18:57:46 +00:00
john added this to the All Datatypes Behaving milestone 2024-03-13 13:02:57 +00:00
john added this to the The Datatype Overhaul project 2024-03-13 13:06:39 +00:00
john removed this from the The Datatype Overhaul project 2024-03-13 13:11:54 +00:00
john added this to the Fun, Convenient McRogueFace Objects project 2024-03-13 14:36:42 +00:00
Author
Owner
>>> g = mcrfpy.Grid(pos=(10,10), size=(100,100), grid_size=(20,20))
>>> g
<Grid (x=10, y=10, w=100, h=100, center=(160, 160), zoom=1)>
>>> g.grid_size
(20, 20)
>>> g.entities
<UICollection (0 child objects)>
>>> e = mcrfpy.Entity()
>>> e
<Entity (x=0, y=0, sprite_index=0)>
>>> g.entities.append(e)
>>> g
<Grid (x=10, y=10, w=100, h=100, center=(160, 160), zoom=1)>
>>> for ent in g.entities:
...   print(ent)
... 
<Entity (x=0, y=0, sprite_index=0)>
>>> g.entities.append(mcrfpy.Entity((20, 30)))
>>> for ent in g.entities:
...   print(ent)
... 
<Entity (x=0, y=0, sprite_index=0)>
<Entity (x=20, y=30, sprite_index=0)>
``` >>> g = mcrfpy.Grid(pos=(10,10), size=(100,100), grid_size=(20,20)) >>> g <Grid (x=10, y=10, w=100, h=100, center=(160, 160), zoom=1)> >>> g.grid_size (20, 20) >>> g.entities <UICollection (0 child objects)> >>> e = mcrfpy.Entity() >>> e <Entity (x=0, y=0, sprite_index=0)> >>> g.entities.append(e) >>> g <Grid (x=10, y=10, w=100, h=100, center=(160, 160), zoom=1)> >>> for ent in g.entities: ... print(ent) ... <Entity (x=0, y=0, sprite_index=0)> >>> g.entities.append(mcrfpy.Entity((20, 30))) >>> for ent in g.entities: ... print(ent) ... <Entity (x=0, y=0, sprite_index=0)> <Entity (x=20, y=30, sprite_index=0)> ```
john closed this issue 2025-07-11 17:23:25 +00:00
Sign in to join this conversation.
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: john/McRogueFace#26
No description provided.