Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2D version #16

Open
bitbug42 opened this issue Nov 17, 2019 · 0 comments
Open

2D version #16

bitbug42 opened this issue Nov 17, 2019 · 0 comments

Comments

@bitbug42
Copy link

While a console project is cool as a draft, a graphical version would be nice to appeal to a casual audience.

Rendering could be done using a graphic API like this:

screen.set_pixel(0,0, "#000000") # Black border
screen.set_pixel(1,0, "#ffffff") # 1st pixel of the 1st tile
screen.set_pixel(2,0, "#ffffff") # 2nd pixel of the 1st tile

etc...

Then detecting mouse clicks could be done in this way:
(set "move" to None if the cursor is not over a clickable cell, or the cell number otherwise)

x, y = get_mouse_position()
if x == 0 and y == 0: move = None
if x == 1 and y == 0: move = 1
if x == 2 and y == 0: move = 1
# ...
if x == 50 and y == 50: move = 5
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant