• vector2's can be added, subtracted, scaled, etc, so you could simplify that whole if/else block as

    deltaPos=touch.location-n0de.position n0de.position = self.speed * deltaPos/abs(deltaPos)

    (well, not quite, but it probably does what you intended, which is to move in the direction of your finger by self.speed. your code would technically be moving faster along diagonals)

  • I couldnt reproduce your issue, but i was using your original code. Ill try with your gist.

    one issue is that SpriteNodes take up resources, and it is not a good idea to have 10000 of them in a scene. Your code ran at about 3fps for me.. though i think the images i was using were larger than 20x20, so all the rescaling might be hurting performance too.

    it seems to work well to render a single ground texture(which can be stored to a ui.Image, once), then just update bits as needed. This could be done prior to starting the scene, or even saved in a file for faster initial starting. It is not really necessary to try to do screen bounds checking, except maybe if you start getting into really huge maps, but in that case it makes more sense to divide the map into "zones", and you would only ever be showing the 9 adjacent zones to the current zone.

    https://gist.github.com/f55322ba716116cf7bf4cbc2e52a0b97
    Here is a version that operates at 60fps on my old ipad3 using this idea. themap was changed to an array of indexes, so you could still do things like collision checking with ground tiles of certain type. I render the entire map to an image/texture.

    edit mode has a second of lag or so, because it still has to draw the original map, then draw a new tile on top, then convert that to a texture again. Dividing the ground into a small number, say 10x10 of chunks each containing a single texture of 10x10 tiles probably would speed that up even more.

    i was lazy on the edit mode tile indexing, it works, but may be somewhat imprecise. probably need something like (xy.x+unit) // (2*unit) to match the center, not corner, of grid, but you maybe would want to draw the touch, and print the grid Coords to confirm.

  • You might try removing the self.pause=True.

    It would be helpful if you could post your game menu code as well, so this is a runnable example.

Internal error.

Oops! Looks like something went wrong!