summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustyna Ilczuk <justyna.ilczuk@gmail.com>2012-12-27 12:29:28 +0100
committerJustyna Ilczuk <justyna.ilczuk@gmail.com>2012-12-27 12:29:28 +0100
commit3f7ae0846aee0b2db1e8b50a2395ec8a9ac9ec8a (patch)
treeb7bb022045dc99b9c58fec1e1ad3ea4c50a40633
parenta0b673afc1ca7f6ba684fdaaf4af8cff6bbf69c0 (diff)
downloadRutherford-3f7ae0846aee0b2db1e8b50a2395ec8a9ac9ec8a.tar.gz
Rutherford-3f7ae0846aee0b2db1e8b50a2395ec8a9ac9ec8a.tar.bz2
Rutherford-3f7ae0846aee0b2db1e8b50a2395ec8a9ac9ec8a.zip
Modify width of the beam if you like ;)
-rw-r--r--rutherford.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/rutherford.py b/rutherford.py
index 917e41e..60230c6 100644
--- a/rutherford.py
+++ b/rutherford.py
@@ -77,6 +77,14 @@ def main():
simulation_running = False
else:
simulation_running = True
+ elif event.key == K_COMMA:
+ universe.settings.beam_width -= 5
+ if(universe.settings.beam_width < 5):
+ universe.settings.beam_width = 5
+ elif event.key == K_PERIOD:
+ universe.settings.beam_width += 5
+
+
print "Pygame thread exited."
@@ -123,8 +131,13 @@ class Screen:
pygame.draw.circle(self.window, RED, end_position, 2)
def draw_guide(self):
y = self.universe.settings.initial_y
+ offset = self.universe.settings.beam_width
for x in range(0, 39, 2):
pygame.draw.aaline(self.window, BLACK, (X_SCREEN_BORDER*x/40, y), (X_SCREEN_BORDER*(x+1)/40, y), 4)
+ for x in range(0, 79, 2):
+ pygame.draw.aaline(self.window, RED, (X_SCREEN_BORDER*x/80, y + offset), (X_SCREEN_BORDER*(x+1)/80, y + offset), 2)
+ for x in range(0, 79, 2):
+ pygame.draw.aaline(self.window, RED, (X_SCREEN_BORDER*x/80, y - offset), (X_SCREEN_BORDER*(x+1)/80, y - offset), 2)
@@ -201,6 +214,7 @@ class SimulationSettings:
self.instructions = [ "Instructions:",
"To change speed, use right and left arrow keys",
"To change position of the beam, use up and down arrow keys",
+ "To change width of the beam, use , and . keys",
"To add particle, press space",
"To stop/restart simulation, press enter"]