# python misbehavior

HELLO BA!
first of all, thanks for your time and thanks for this webpage!, has been a endless resource of inspiration, help and learning material!
Im new here so here is a small introduction:
I’ve been around a month getting into game dev and, since i chose blender as a learning plataform, python.
what Im most interested into learning is coding, I started with C , but then kind of saw that python would engage me more as a beggining lenguage. Anyway, basics of modelling: done, basics of animating: done, basics of logic bricks: Done basics of python scripting: catastrofic (so far). hehe:RocknRoll:
anyway, the question in hand:

``````                  My point here is, for a empty, to move, then add a plane (1x1) on the spot, then  move, then add a plane and so on, and then will end up with a 100X100 plain,  so i scripted:
``````

import bge

dunWidth = 100 #meters/tiles
dunHeight = 100 #meters/tiles
b = 0
a = 0
add= bge.logic.getCurrentScene().addObject

def main():
global b, a
cont = bge.logic.getCurrentController()
dunMarker = cont.owner
#Movement Calculation: (X, Y, Z)
while b < dunWidth:
b += 1
add(“FloorTile”, “DunMarker”,0)
dunMarker.applyMovement((1,0,0), False)
while a < dunHeight:
add(“FloorTile”, “DunMarker”,0)
a += 1
dunMarker.applyMovement((0,1,0), False)
#dunMarker.applyMovement((0,-dunHeight,0), False) #–> ment to erase the position of Y from 100 to 0 again, but dosent work.
main() but instead, to my surprise, it First add the tile, then goes through the loop ignoring the add(), so the result is a 1x1 tile at 0x0y and the empty ends at 100x100y… how many things Im doing wrong here?Aaaand, since we are here, how would you improve the coding?(trying to learn here )

pd, yeah, Roguelike 3D project