Skip to content

Commit d6b5336

Browse files
Fixed grammer, Update Readme
1 parent f2ce50d commit d6b5336

File tree

9 files changed

+25
-13
lines changed

9 files changed

+25
-13
lines changed

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,28 @@
1818
</div>
1919

2020

21-
![Screenshot](./screenshots/screenshot1.png)
21+
![Screenshot](./screenshots/screenshot.png)
2222

23-
Gravity sandbox is a simple gravity simulator based on Newton's law of universal
24-
gravitation.
23+
Gravity Sandbox is a fun toy/game where you can play with Newtonian Gravity. Place heavy objects in patterns and see interesting results.
2524

26-
It's a web-based simulation so no need to install anything, just visit
25+
It's a web app so no need to install anything, just visit
2726
[the website](https://gravity-sandbox.netlify.app/) to play the game
2827

2928
## Controls
3029

31-
- ![play/pause button](./screenshots/play-pause-btn.png) To play and pause
32-
- ![pan/place button](./screenshots/pan-place-btn.png) To Pan/Place Mode
33-
- ![clear button](./screenshots/clear-btn.png) To clear the canvas
34-
- Click on the body while in pan mode to follow
30+
On the left side, there are 5 buttons for Play/Pause, Place Mode, Pan Mode, Selection Mode, Clear All, and Load Presets.
31+
32+
On the right side, the `Mass` and `Color` properties are for new bodies and `Speed` and `Gravity` are for simulation.
33+
34+
## Shortcuts
35+
36+
- Pause/Play: `space`
37+
- Place Mode: `p`
38+
- Pan Mode: `h`
39+
- Selection Mode: `s`
40+
- Clear `All: c`
41+
- Undo: `CTRL + Z`
42+
- Redo: `CTRL + Y`
43+
- Delete Selection: `delete`
44+
- New File: `CTRL + M`
45+
- Save File: `CTRL + S`

index.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,15 @@
9797
<span class="close-btn">Close</span>
9898
<h2 style="text-align: center;">Gravity Sandbox</h2>
9999
<p>
100-
Gravity Sandbox is a fun toy/game where you can play with Newtonian Gravity
101-
by placing heavy objects in patterns and see intersting results.
100+
Gravity Sandbox is a fun toy/game where you can play with Newtonian Gravity.
101+
Place heavy objects in patterns and see interesting results.
102102
</p>
103103
<h3>Controls</h3>
104104
<p>
105-
On the left side there are 5 buttons for Play/Pause, Place Mode, Pan Mode, Selection Mode,
106-
Clear All, and Load Presets.
105+
On the left side, there are 5 buttons for Play/Pause, Place Mode, Pan Mode, Selection Mode, Clear All, and Load Presets.
107106
</p>
108107
<p>
109-
On the right side the <code>Mass</code> and <code>Color</code> properties are for
108+
On the right side, the <code>Mass</code> and <code>Color</code> properties are for
110109
new bodies and <code>Speed</code> and <code>Gravity</code> are for simulation.
111110
</p>
112111
<h3>Shortcuts</h3>

screenshots/clear-btn.png

-515 Bytes
Binary file not shown.

screenshots/pan-place-btn.png

-649 Bytes
Binary file not shown.

screenshots/play-pause-btn.png

-250 Bytes
Binary file not shown.

screenshots/screenshot.png

208 KB
Loading

screenshots/screenshot1.png

-46 KB
Binary file not shown.

src/Universe.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export default class Universe {
111111
}
112112

113113
clear() {
114+
this.undoHistory.push({type: "delete", bodies:this.bodies})
114115
this.bodies = [];
115116
this.previousPlacedCoords = {};
116117
}

src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ window.addEventListener('load', () => {
509509
switchMode("add");
510510
} else if (e.key === "c" || e.code === "C") {
511511
U.clear();
512+
updateInfoBar();
512513
} else if (e.ctrlKey && (e.key === "z" || e.code === "Z")) {
513514
e.preventDefault();
514515
undo();

0 commit comments

Comments
 (0)