0

in this little piece of code i try to add different layer of rendering step by step, but it seems there s something i missed in the way it works.

[.....]
    with tcod.context.new_terminal(  
        cons_width, cons_height, tileset=tileset, title='Map Generation Test'
    ) as context:
        console = tcod.Console(cons_width, cons_height, order='F')
        while int(steps) <=  int(render_steps):
            int(steps) += 1
            console.print(map_obj.x, map_obj.y, map_obj.string)
            context.present(console)

here steps is = 1 and render_steps is an input from the user. Is there a way to update the console so i can change this to: "while true: console print(map..."

Thanks for reading.

  • you can't add `+=` to `int(steps)` because it works like `2 += 1`, You should do `steps = int(steps)` before `while`-loop, and later `step += 1`. But if `steps` is already integer value then you don't need `int()` – furas Feb 25 '22 at 21:03
  • or maybe you should do `for _ in range(int(steps), int(render_steps)+1):` instead of `while`-loop – furas Feb 25 '22 at 21:07
  • if you will use `while True` then you will need also `if int(steps) <= int(render_steps): break` and this seems longer then current `while`-loop. – furas Feb 25 '22 at 21:09
  • Thanks furas, i ll try to implement this during my 4 hours train trip this morning. Hope i ll Come back with a working solution this afternoon! – Rythmithik Feb 27 '22 at 07:39

0 Answers0