-
Notifications
You must be signed in to change notification settings - Fork 0
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
Idea for Game of Life #1
Comments
Nice! this kind of functionality can be used in making a drawing program as well.. If you switch mousedown/mousmove to the more general pointerdown/pointermove events then they can also be used with a stylus or finger on a tablet.
It's interesting to think of the ways in which little choices like this affect the behavior and attitude of the person using your program. I imagine a click-drag mechanic would would get people into a drawing mode, while disallowing it would encourage a more deliberate placement of pieces, but I think even then people were trying to write their names and draw designs and stuff. It would probably have to be made into a progressive "game" in order to get people to really think about the rules.
BTW I recommend a darker grey for the grid squares, just light enough that you can tell them apart from the background, but not so light that they distract from the game action.
Good job that your're still working on the site! It's nice watching it develop. The new background is cool... It has that early 2000's feel. This is how the internet was meant to be before social media took over!
PS. a linux user is now greeted with a "Your device is not compatible with the game." message upon arrival. You probably meant that only for the downloadable games? I can still enjoy a fine game of Hit The Wall even on my boomer OS!
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
…On Tuesday, June 22nd, 2021 at 4:22 PM, kai17kai ***@***.***> wrote:
Something I did when I create the Game of Life was a drag and click thing. I noticed that you didn't add this feature to the Game of Life on your website. Github, for some odd reason, doesn't support .js files so here is the code.
`let drag = false, moved = false;
canvas.onmouseup = (event) => {
drag = moved;
let x = (event.clientX-rect.left)(canvas.width/rect.width);
let y = (event.clientY-rect.top)(canvas.height/rect.height);
let col = Math.floor(x/cell_width);
let row = Math.floor(y/cell_width);
if (!drag) {
grid[row][col][0] ^= 1;
} else {
grid[row][col][0] = 1;
drag = false;
}
moved = false;
save_grid();
clear();
grid_to_canvas();
}
canvas.onmousedown = () => {
generations = 0;
print_generations();
stop();
drag = true;
}
canvas.onmousemove = (e) => {
if (drag) {
moved = true;
let x = (e.clientX - rect.left) * (canvas.width / rect.width);
let y = (e.clientY - rect.top) * (canvas.height / rect.height);
x = Math.floor(x / cell_width);
y = Math.floor(y / cell_width);
grid[y][x][0] = 1;
save_grid();
clear();
grid_to_canvas();
}
}`
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, [view it on GitHub](#1), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AN5FQBQCFUQ2EOSVBGZF6D3TUELMLANCNFSM47EUSEYQ).
|
I only meant for the error to happen with the downloadable games because one of the games is only built for mac and windows at the moment. I will need to fix that but thank you for telling me that. Also, the background is from Prisha so give credit to her for the background. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Something I did when I create the Game of Life was a drag and click thing. I noticed that you didn't add this feature to the Game of Life on your website. Github, for some odd reason, doesn't support .js files so here is the code.
`let drag = false, moved = false;
canvas.onmouseup = (event) => {
drag = moved;
let x = (event.clientX-rect.left)(canvas.width/rect.width);
let y = (event.clientY-rect.top)(canvas.height/rect.height);
let col = Math.floor(x/cell_width);
let row = Math.floor(y/cell_width);
if (!drag) {
grid[row][col][0] ^= 1;
} else {
grid[row][col][0] = 1;
drag = false;
}
moved = false;
save_grid();
clear();
grid_to_canvas();
}
canvas.onmousedown = () => {
generations = 0;
print_generations();
stop();
drag = true;
}
canvas.onmousemove = (e) => {
if (drag) {
moved = true;
let x = (e.clientX - rect.left) * (canvas.width / rect.width);
let y = (e.clientY - rect.top) * (canvas.height / rect.height);
x = Math.floor(x / cell_width);
y = Math.floor(y / cell_width);
grid[y][x][0] = 1;
save_grid();
clear();
grid_to_canvas();
}
}`
The text was updated successfully, but these errors were encountered: