diff --git a/NS.py b/NS.py index 769afc3..ea5cc8b 100644 --- a/NS.py +++ b/NS.py @@ -245,9 +245,12 @@ class Title(GameChild): y += step def get_formatted_time(self, entry): - minutes, milliseconds = divmod(int(entry), 60000) - seconds, fraction = divmod(milliseconds, 1000) - return "%i:%02i.%i" % (minutes, seconds, fraction / 100) + if int(entry) == 5999999: + return "--:--.-" + else: + minutes, milliseconds = divmod(int(entry), 60000) + seconds, fraction = divmod(milliseconds, 1000) + return "%i:%02i.%i" % (minutes, seconds, fraction / 100) def update(self): if self.active: @@ -505,7 +508,7 @@ class Introduction(Animation): platform = self.get_game().platform if platform.get_edge_pressed() == self.TUTORIAL_MOVES[self.tutorial_index]: self.tutorial_index += 1 - self.get_game().sfx["land"].play() + self.get_game().sfx["land_0"].play() if self.tutorial_index == len(self.TUTORIAL_MOVES): self.text_index += 1 self.advance_prompt.cancel_first_press() @@ -957,10 +960,10 @@ class Chemtrails(Sprite): self.timer.reset() if not boss.is_playing(boss.show_end_dialogue): boss.combo() - boss.damaged.unhide() - self.get_game().sfx["complete_pattern"].play() + # boss.damaged.unhide() + self.get_game().sfx["complete_pattern_3"].play() else: - self.get_game().sfx["land"].play() + self.get_game().sfx["land_0"].play() self.get_game().platform.reset_lights() def orient(self): @@ -1094,13 +1097,10 @@ class Boss(Animation): self.kool_man = RainbowSprite(self, load(self.get_resource("Kool_man_waah.png")).convert_alpha(), 30) self.visitor = RainbowSprite(self, load(self.get_resource("Visitor.png")).convert_alpha(), 30) self.spoopy = RainbowSprite(self, load(self.get_resource("Spoopy.png")).convert_alpha(), 30) - self.damaged = Sprite(self) - self.damaged.load_from_path(self.get_resource("kool/damage.png"), True) - self.damaged.location.topleft = 174, 22 self.health = Health(self) self.sword = Sword(self) self.register(self.brandish, self.cancel_flash, self.show_introduction_dialogue, - self.show_end_dialogue, self.cancel_damaged) + self.show_end_dialogue) self.kool_man.add_frameset([0], name="normal", switch=True) self.visitor.add_frameset([0], name="normal", switch=True) self.spoopy.add_frameset([0], name="normal", switch=True) @@ -1121,15 +1121,6 @@ class Boss(Animation): elif self.level_index == 2: self.spoopy.set_frameset("normal") - def cancel_damaged(self): - self.damaged.hide() - if self.level_index == 0: - self.kool_man.unhide() - elif self.level_index == 1: - self.visitor.unhide() - elif self.level_index == 2: - self.spoopy.unhide() - def start_level(self, index): self.level_index = index self.battle_finished = False @@ -1186,8 +1177,6 @@ class Boss(Animation): self.advance_prompt.reset() self.queue = None self.brandish_complete = True - self.halt(self.cancel_damaged) - self.damaged.hide() def deactivate(self): self.active = False @@ -1202,9 +1191,7 @@ class Boss(Animation): def brandish(self): self.queue = [] platform = self.get_game().platform - self.damaged.hide() if self.level_index == 0: - self.kool_man.hide() if self.health.amount > 90: first = choice(platform.get_steps_from_edge(self.last_attack)) self.queue = [first] @@ -1377,17 +1364,9 @@ class Boss(Animation): self.battle_finished = True self.halt(self.brandish) self.halt(self.cancel_flash) - self.halt(self.cancel_damaged) self.sword.reset() self.queue = [] self.brandish_complete = True - if self.level_index == 0: - self.kool_man.unhide() - elif self.level_index == 1: - self.visitor.unhide() - elif self.level_index == 2: - self.spoopy.unhide() - self.damaged.hide() if win: if self.level_index == 0: self.kool_man.set_frameset(0) @@ -1451,6 +1430,7 @@ class Boss(Animation): def update(self): if self.active: self.backgrounds[self.level_index].update() + # self.get_display_surface().fill((0, 0, 0)) dialogue = self.get_game().dialogue if dialogue.active: if self.advance_prompt.check_first_press(): @@ -1468,7 +1448,6 @@ class Boss(Animation): else: self.time_elapsed += self.get_game().time_filter.get_last_frame_duration() Animation.update(self) - self.damaged.update() if self.level_index == 0: self.kool_man.update() elif self.level_index == 1: @@ -1493,35 +1472,39 @@ class Sword(Animation): def __init__(self, parent): Animation.__init__(self, parent) - image = load(self.get_resource("Sword.png")).convert_alpha() - sprites = self.sprites = [] - # for _ in xrange(6): + swords = self.swords = [] + for path in ("Sword_kool_man.png", "Sword_visitor.png", "Sword_spoopy.png"): + swords.append([]) + image = load(self.get_resource(path)).convert_alpha() + for _ in xrange(6): + sprite = Sprite(self) + sprite.add_frame(image) + for angle in 270, 315, 45: + sprite.add_frame(rotate(image, angle)) + sprite.add_frameset([0], name="vertical") + sprite.add_frameset([1], name="horizontal") + sprite.add_frameset([2], name="rdiagonal") + sprite.add_frameset([3], name="ldiagonal") + sprite.set_frameset("vertical") + sprite.location.center = self.get_display_surface().get_rect().center + swords[-1].append(sprite) + # for _ in xrange(self.SPRITE_COUNT): # sprite = Sprite(self) - # sprite.add_frame(image) - # for angle in 270, 315, 45: - # sprite.add_frame(rotate(image, angle)) - # sprite.add_frameset([0], name="vertical") - # sprite.add_frameset([1], name="horizontal") - # sprite.add_frameset([2], name="rdiagonal") - # sprite.add_frameset([3], name="ldiagonal") - # sprite.set_frameset("vertical") - # sprite.location.center = self.get_display_surface().get_rect().center + # sprite.load_from_path(self.get_resource("kool/"), True, query="[0-9]-*.png") + # for ii in xrange(6): + # sprite.add_frameset(ii) + # sprite.location.topleft = 114, 0 # sprites.append(sprite) - for _ in xrange(self.SPRITE_COUNT): - sprite = Sprite(self) - sprite.load_from_path(self.get_resource("kool/"), True, query="[0-9]-*.png") - for ii in xrange(6): - sprite.add_frameset(ii) - sprite.location.topleft = 114, 0 - sprites.append(sprite) self.register(self.brandish, self.lower) def reset(self): self.halt(self.brandish) self.halt(self.lower) self.next_index = 0 - for sprite in self.sprites: - sprite.hide() + self.sprites = self.swords[self.get_game().boss.level_index] + for sword in self.swords: + for sprite in sword: + sprite.hide() def brandish(self): sprite = self.sprites[self.next_index] @@ -1529,27 +1512,28 @@ class Sword(Animation): self.next_index += 1 sprite.unhide() dsr = self.get_display_surface().get_rect() - # if position in (NS.W, NS.E): - # sprite.set_frameset("vertical") - # sprite.location.centery = dsr.centery - 100 - # if position == NS.W: - # sprite.location.centerx = dsr.centerx - 100 - # else: - # sprite.location.centerx = dsr.centerx + 100 - # elif position in (NS.N, NS.S): - # sprite.set_frameset("horizontal") - # sprite.location.centerx = dsr.centerx - # if position == NS.N: - # sprite.location.centery = dsr.centery - 200 - # else: - # sprite.location.centery = dsr.centery - # else: - # if position == NS.NW: - # sprite.set_frameset("ldiagonal") - # else: - # sprite.set_frameset("rdiagonal") - # sprite.location.center = dsr.centerx, dsr.centery - 100 - sprite.set_frameset(position + 1) + if position in (NS.W, NS.E): + sprite.set_frameset("vertical") + sprite.location.centery = dsr.centery - 100 + if position == NS.W: + sprite.location.centerx = dsr.centerx - 100 + else: + sprite.location.centerx = dsr.centerx + 100 + elif position in (NS.N, NS.S): + sprite.set_frameset("horizontal") + sprite.location.centerx = dsr.centerx + if position == NS.N: + # sprite.location.centery = dsr.centery - 200 + sprite.location.centery = dsr.centery - 170 + else: + sprite.location.centery = dsr.centery + else: + if position == NS.NW: + sprite.set_frameset("ldiagonal") + else: + sprite.set_frameset("rdiagonal") + sprite.location.center = dsr.centerx, dsr.centery - 100 + # sprite.set_frameset(position + 1) self.get_game().sfx["brandish"].play() self.play(self.lower, delay=400, play_once=True) if len(self.parent.unbrandished) > 0: @@ -1593,12 +1577,12 @@ class Sword(Animation): else: location = sprite.location.move(offset[sprite.sword_position], -offset[sprite.sword_position]) - # if sprite.sword_position == NS.N or sprite.sword_position == NS.S: - # surface.fill(color_a, (0, 0, rect.w / 2, rect.h), BLEND_RGBA_MIN) - # surface.fill(color_b, (rect.centerx, 0, rect.w / 2, rect.h), BLEND_RGBA_MIN) - # else: - # surface.fill(color_a, (0, 0, rect.w, rect.h / 2), BLEND_RGBA_MIN) - # surface.fill(color_b, (0, rect.centery, rect.w, rect.h / 2), BLEND_RGBA_MIN) + if sprite.sword_position == NS.N or sprite.sword_position == NS.S: + surface.fill(color_a, (0, 0, rect.w / 2, rect.h), BLEND_RGBA_MIN) + surface.fill(color_b, (rect.centerx, 0, rect.w / 2, rect.h), BLEND_RGBA_MIN) + else: + surface.fill(color_a, (0, 0, rect.w, rect.h / 2), BLEND_RGBA_MIN) + surface.fill(color_b, (0, rect.centery, rect.w, rect.h / 2), BLEND_RGBA_MIN) surface.fill((255, 255, 255, alpha), None, BLEND_RGBA_MIN) self.get_display_surface().blit(surface, location) offset[sprite.sword_position] += self.OFFSET @@ -1638,6 +1622,7 @@ class Health(GameChild): self.parent.damage() if self.amount <= 0: self.amount = 0 + self.get_game().sfx["complete_pattern_1"].play() self.get_game().sfx["defeat"].play() self.get_game().boss.finish_battle(True) else: @@ -1678,7 +1663,7 @@ class Ending(Animation): self.tony = load(self.get_resource("Big_Tony.png")).convert() self.slime_bag = Sprite(self) self.slime_bag.load_from_path(self.get_resource("Introduction_slime_bag.png"), True) - self.slime_bag.location.center = self.get_display_surface().get_rect().center + self.slime_bag.location.center = self.get_display_surface().get_rect().centerx, 300 self.tony_avatar = load(self.get_resource("Introduction_tony_avatar.png")).convert() self.advance_prompt = AdvancePrompt(self) self.register(self.start) @@ -1696,6 +1681,15 @@ class Ending(Animation): def activate(self): self.active = True self.play(self.start, delay=3000, play_once=True) + font = Font(self.get_resource("rounded-mplus-1m-bold.ttf"), 64) + time = self.get_game().title.get_formatted_time(self.get_game().most_recent_time) + foreground = font.render(time, True, (255, 28, 28)) + # background = font.render(time, True, (0, 220, 220)) + dsr = self.get_display_surface().get_rect() + self.text = RainbowSprite(self, foreground, 120) + self.text.location.midtop = dsr.centerx, 80 + # self.shadow = RainbowSprite(self, background, 120) + # self.shadow.location.midtop = dsr.centerx + 2, 70 def start(self): self.advance_prompt.cancel_first_press() @@ -1732,13 +1726,8 @@ class Ending(Animation): self.advance_prompt.cancel_first_press() self.get_display_surface().blit(self.tony, (0, 0)) self.slime_bag.update() - font = Font(self.get_resource("rounded-mplus-1m-bold.ttf"), 36) - text = font.render(self.get_game().title.get_formatted_time(self.get_game().most_recent_time), - True, Color("black")) - rect = text.get_rect() - ds = self.get_display_surface() - rect.midtop = ds.get_rect().centerx, 320 - ds.blit(text, rect) + # self.shadow.update() + self.text.update() self.get_game().dialogue.update() if not wipe.is_playing() and not self.is_playing(self.start): self.advance_prompt.update() diff --git a/config b/config index bb9d862..d3d59fc 100644 --- a/config +++ b/config @@ -9,7 +9,7 @@ data-exclude = local/, *.pyc [display] caption = Electric Scrapeboard -show-framerate = yes +show-framerate = no dimensions = 640, 480 fullscreen = no diff --git a/index.php b/index.php new file mode 120000 index 0000000..62da3c0 --- /dev/null +++ b/index.php @@ -0,0 +1 @@ +www/index.php \ No newline at end of file diff --git a/resource/Spoopy.png b/resource/Spoopy.png index 9c52204..a4e047c 100644 Binary files a/resource/Spoopy.png and b/resource/Spoopy.png differ diff --git a/resource/Sword_kool_man.png b/resource/Sword_kool_man.png new file mode 100644 index 0000000..ddb3918 Binary files /dev/null and b/resource/Sword_kool_man.png differ diff --git a/resource/Sword_spoopy.png b/resource/Sword_spoopy.png new file mode 100644 index 0000000..e0fe9c7 Binary files /dev/null and b/resource/Sword_spoopy.png differ diff --git a/resource/Sword_visitor.png b/resource/Sword_visitor.png new file mode 100644 index 0000000..a081cdd Binary files /dev/null and b/resource/Sword_visitor.png differ diff --git a/resource/Visitor.png b/resource/Visitor.png index 507d13d..b55ef82 100644 Binary files a/resource/Visitor.png and b/resource/Visitor.png differ diff --git a/resource/scores b/resource/scores index 454cd20..c236b0a 100644 --- a/resource/scores +++ b/resource/scores @@ -8,28 +8,4 @@ 5999999 5999999 5999999 -163063 -143896 -177012 -126061 -157603 -136643 -177268 -151171 -131298 -130375 -134183 -174976 -142026 -140320 -132416 -159243 -227709 -153523 -155712 -247891 -178357 -202333 -278582 -286504 -179511 +293967 diff --git a/resource/sfx/complete_pattern_0.wav b/resource/sfx/complete_pattern_0.wav new file mode 100644 index 0000000..be8a200 Binary files /dev/null and b/resource/sfx/complete_pattern_0.wav differ diff --git a/resource/sfx/complete_pattern_1.wav b/resource/sfx/complete_pattern_1.wav new file mode 100644 index 0000000..1528a2d Binary files /dev/null and b/resource/sfx/complete_pattern_1.wav differ diff --git a/resource/sfx/complete_pattern_2.wav b/resource/sfx/complete_pattern_2.wav new file mode 100644 index 0000000..1a15555 Binary files /dev/null and b/resource/sfx/complete_pattern_2.wav differ diff --git a/resource/sfx/complete_pattern_3.wav b/resource/sfx/complete_pattern_3.wav new file mode 100644 index 0000000..22ab348 Binary files /dev/null and b/resource/sfx/complete_pattern_3.wav differ diff --git a/resource/sfx/land_0.wav b/resource/sfx/land_0.wav new file mode 100644 index 0000000..18e6864 Binary files /dev/null and b/resource/sfx/land_0.wav differ diff --git a/resource/sfx/land_1.wav b/resource/sfx/land_1.wav new file mode 100644 index 0000000..7a05dd6 Binary files /dev/null and b/resource/sfx/land_1.wav differ diff --git a/resource/sfx/land_2.wav b/resource/sfx/land_2.wav new file mode 100644 index 0000000..481a601 Binary files /dev/null and b/resource/sfx/land_2.wav differ diff --git a/resource/sfx/land_3.wav b/resource/sfx/land_3.wav new file mode 100644 index 0000000..2d72157 Binary files /dev/null and b/resource/sfx/land_3.wav differ diff --git a/serial/analog.ino/analog.ino.ino b/serial/analog.ino/analog.ino.ino new file mode 100644 index 0000000..afc0567 --- /dev/null +++ b/serial/analog.ino/analog.ino.ino @@ -0,0 +1,61 @@ +int pushButton1 = 2; +int pushButton2 = 4; +int pushButton3 = 6; +int pushButton4 = 11; + +int buttons[4] = {pushButton1, pushButton2, pushButton3, pushButton4}; + + +void setup() { + // set the digital pin as output: + Serial.begin(9600); + pinMode(pushButton1, OUTPUT); + digitalWrite(pushButton1, LOW); + pinMode(pushButton2, INPUT_PULLUP); + pinMode(pushButton3, INPUT_PULLUP); + pinMode(pushButton4, INPUT_PULLUP); +} + +void loop() { + bool received_input = false; + for (int ii = 0; ii < 4; ii++) + { + for (int jj = 0; jj < 4; jj++) + { + if (jj == ii) + { + pinMode(buttons[jj], OUTPUT); + digitalWrite(buttons[jj], LOW); + } + else + { + pinMode(buttons[jj], INPUT_PULLUP); + } + } + for (int jj = ii; jj < 4; jj++) + { + if (!(ii == jj) && !digitalRead(buttons[jj])) + { + Serial.println(analogRead(buttons[jj])); + for (int kk = 3; kk >= 0; kk--) + { + if (kk == ii || kk == jj) + { + Serial.print(1); + } + else + { + Serial.print(0); + } + } + Serial.print("\n"); + received_input = true; + break; + } + } + if (received_input) + { + break; + } + } +} diff --git a/serial/serial.ino b/serial/serial.ino index b52b395..03506fc 100644 --- a/serial/serial.ino +++ b/serial/serial.ino @@ -6,9 +6,9 @@ unsigned long previousMillis = 0; // will store last time LED was updated const long interval = 500; // interval at which to blink (milliseconds) int pushButton1 = 2; -int pushButton2 = 3; -int pushButton3 = 4; -int pushButton4 = 5; +int pushButton2 = 4; +int pushButton3 = 6; +int pushButton4 = 11; int buttons[4] = {pushButton1, pushButton2, pushButton3, pushButton4}; @@ -24,7 +24,6 @@ void setup() { } void loop() { - unsigned long currentMillis = millis(); bool received_input = false; for (int ii = 0; ii < 4; ii++) { @@ -65,23 +64,4 @@ void loop() { break; } } - - if (currentMillis - previousMillis >= interval) - { - previousMillis = currentMillis; -//if(digitalRead(pushButton1)==0){ -//} - -//if(digitalRead(pushButton2)==0){ -// Serial.println("1-2"); -//} -//if(digitalRead(pushButton3)==0){ -// Serial.println("1-3"); -//} -//if(digitalRead(pushButton4)==0){ -// Serial.println("1-4"); -//} - } - - } diff --git a/www/Babycastles.jpg b/www/Babycastles.jpg new file mode 100644 index 0000000..3471cd7 Binary files /dev/null and b/www/Babycastles.jpg differ diff --git a/www/Boarding_0.gif b/www/Boarding_0.gif new file mode 100644 index 0000000..f358415 Binary files /dev/null and b/www/Boarding_0.gif differ diff --git a/www/Boarding_1.gif b/www/Boarding_1.gif new file mode 100644 index 0000000..0139a2f Binary files /dev/null and b/www/Boarding_1.gif differ diff --git a/www/Boarding_2.gif b/www/Boarding_2.gif new file mode 100644 index 0000000..752c6a2 Binary files /dev/null and b/www/Boarding_2.gif differ diff --git a/www/Boarding_3.gif b/www/Boarding_3.gif new file mode 100644 index 0000000..a95ad5a Binary files /dev/null and b/www/Boarding_3.gif differ diff --git a/www/Togepi.jpg b/www/Togepi.jpg new file mode 100644 index 0000000..ac9574d Binary files /dev/null and b/www/Togepi.jpg differ diff --git a/www/clamp.jpg b/www/clamp.jpg new file mode 100644 index 0000000..5d62dc9 Binary files /dev/null and b/www/clamp.jpg differ diff --git a/www/index.php b/www/index.php new file mode 100644 index 0000000..455d30e --- /dev/null +++ b/www/index.php @@ -0,0 +1,58 @@ + + + Electric Scrapeboard + + + +
+ + + +
+
+ So you think you can skateboard, but can you scrapeboard, you slime bag? +
+
+ + +
+
+
+ We have the technology to put you on a board which is a + wireless electric video game controller. Do you have the + moves to skate through a gauntlet of goons all the way + to Tony Hawk? + @diskmem + @snakesandrews +
+
+ We have the technology to put you on a board which is a + wireless electric video game controller. Do you have the + moves to skate through a gauntlet of goons all the way + to Tony Hawk? +
+
+ We have the technology to put you on a board which is a + wireless electric video game controller. Do you have the + moves to skate through a gauntlet of goons all the way + to Tony Hawk? +
+
+ We have the technology to put you on a board which is a + wireless electric video game controller. Do you have the + moves to skate through a gauntlet of goons all the way + to Tony Hawk? +
+
+ We have the technology to put you on a board which is a + wireless electric video game controller. Do you have the + moves to skate through a gauntlet of goons all the way + to Tony Hawk? +
+
+
+ + +
+ + diff --git a/www/style.css b/www/style.css new file mode 100644 index 0000000..7464128 --- /dev/null +++ b/www/style.css @@ -0,0 +1,163 @@ +@import url("../../../lib/fonts/notcouriersans/regular/style.css"); +@import url("../../../lib/fonts/notcouriersans/bold/style.css"); +@import url("../../../lib/fonts/cantarell/bold/style.css"); + +body +{ + /* background: url("../resource/Ink.png"); */ + background-size: 100% auto; + margin: 15px; +} + +div#title +{ + text-align: center; + position: relative; + margin-bottom: 40px; + overflow: hidden; +} + +div#title img#plank +{ + border-top: 13px dotted lime; + border-radius: 100px; + border-bottom: 18px dashed lime; + z-index: 0; +} + +div#title img#board +{ + width: 100px; + transform: rotate(70deg); + background-color: yellow; + border: 3px groove pink; + position: absolute; + z-index: 1; + top: 50px; + left: 52%; + border-radius: 40px; +} + +div#title img#lizard +{ + width: 1000px; + background-color: rgba(255, 100, 100, .2); + opacity: .9; + position: absolute; + top: 0px; + z-index: 2; + left: 40%; + border-radius: 40px; +} + +div#question +{ + width: 65%; + margin: auto; + border: 5px double cyan; + background: #B0D0D0E0; + line-height: 28px; + color: #282828; + padding: 50px; + border-radius: 18px; + font-family: NotCourierSansBold; + font-size: 34px; + margin-bottom: 18px; + position: absolute; + top: -10px; + z-index: 0; +} + +div#blob +{ + position: relative; +} + +div#detail +{ + font-family: NotCourierSans; + font-size: 80px; + text-align: justify; +} + +div#detail a +{ + position: absolute; + top: 80px; + left: 30px; + font-size: 12px; + z-index: 3; +} + +div#detail a#blake +{ + top: 95px; +} + +div#detail2 +{ + font-family: NotCourierSans; + font-size: 80px; + text-align: justify; + position: absolute; + top: 1px; + left: 1px; +} + +div#detail3 +{ + font-family: NotCourierSans; + font-size: 80px; + text-align: justify; + position: absolute; + top: 2px; + left: 2px; +} + +div#detail4 +{ + font-family: NotCourierSans; + font-size: 80px; + text-align: justify; + position: absolute; + top: 3px; + left: 3px; + /* color: gray; */ + /* opacity: .5; */ +} + +div#detail5 +{ + font-family: NotCourierSans; + font-size: 80px; + text-align: justify; + position: absolute; + top: 4px; + left: 4px; + /* opacity: .3; */ +} + +div#photo +{ + text-align: center; + margin-top: 20px; +} + +div#photo img +{ + width: 300px; + border: 18px ridge pink; +} + +div#boarding +{ + text-align: center; +} + +div#boarding img +{ + border-radius: 30px; + margin: 40px 20px; + border: 8px solid black; + width: 400px; +}