5
« on: October 30, 2021, 03:08:11 PM »
I have created a table in Lua for Pico-8 in order to draw a row of invaders every frame (see attached images - code/result)
I'm trying to do the same thing with a dictionary (as it seems to be the closest data type to a table in Lua) in Micro Python and I'm having trouble understanding/figuring out the syntax to do this, I think I've created the dictionary properly but need to create the for loop to iterate through it and display my sprites.
Here's my code so far:
--------------------------------------------------------------------------
inv = {}
# sprite number, x, y
inv = {'s':'invader_a', 'x':40, 'y':28}
inv = {'s':1, 'x':50, 'y':28}
inv = {'s':1, 'x':60, 'y':28}
inv = {'s':1, 'x':70, 'y':28}
inv = {'s':1, 'x':80, 'y':28}
while(1):
thumby.display.fill(0)
for ?:
thumby.display.blit(sprite number?, x?, y?, 8, 8, 0)
--------------------------------------------------------------------------
As you can see, I need help to fill in the for loop and the sprite number?, x?, y? I have a pretty good python book and have read many samples online of how this should work but I haven't been able to come up with a solution that works, any help would be appreciated.
Thanks,
Brian