Browse Source

energy

magfest
Frank DeMarco 4 years ago
parent
commit
b043be4287
  1. 167
      NS.py
  2. 2
      config
  3. 1
      index.php
  4. BIN
      resource/Spoopy.png
  5. BIN
      resource/Sword_kool_man.png
  6. BIN
      resource/Sword_spoopy.png
  7. BIN
      resource/Sword_visitor.png
  8. BIN
      resource/Visitor.png
  9. 26
      resource/scores
  10. BIN
      resource/sfx/complete_pattern_0.wav
  11. BIN
      resource/sfx/complete_pattern_1.wav
  12. BIN
      resource/sfx/complete_pattern_2.wav
  13. BIN
      resource/sfx/complete_pattern_3.wav
  14. BIN
      resource/sfx/land_0.wav
  15. BIN
      resource/sfx/land_1.wav
  16. BIN
      resource/sfx/land_2.wav
  17. BIN
      resource/sfx/land_3.wav
  18. 61
      serial/analog.ino/analog.ino.ino
  19. 26
      serial/serial.ino
  20. BIN
      www/Babycastles.jpg
  21. BIN
      www/Boarding_0.gif
  22. BIN
      www/Boarding_1.gif
  23. BIN
      www/Boarding_2.gif
  24. BIN
      www/Boarding_3.gif
  25. BIN
      www/Togepi.jpg
  26. BIN
      www/clamp.jpg
  27. 58
      www/index.php
  28. 163
      www/style.css

167
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()

2
config

@ -9,7 +9,7 @@ data-exclude = local/, *.pyc
[display]
caption = Electric Scrapeboard
show-framerate = yes
show-framerate = no
dimensions = 640, 480
fullscreen = no

1
index.php

@ -0,0 +1 @@
www/index.php

BIN
resource/Spoopy.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 33 KiB

BIN
resource/Sword_kool_man.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
resource/Sword_spoopy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
resource/Sword_visitor.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
resource/Visitor.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 22 KiB

26
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

BIN
resource/sfx/complete_pattern_0.wav

Binary file not shown.

BIN
resource/sfx/complete_pattern_1.wav

Binary file not shown.

BIN
resource/sfx/complete_pattern_2.wav

Binary file not shown.

BIN
resource/sfx/complete_pattern_3.wav

Binary file not shown.

BIN
resource/sfx/land_0.wav

Binary file not shown.

BIN
resource/sfx/land_1.wav

Binary file not shown.

BIN
resource/sfx/land_2.wav

Binary file not shown.

BIN
resource/sfx/land_3.wav

Binary file not shown.

61
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;
}
}
}

26
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");
//}
}
}

BIN
www/Babycastles.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

BIN
www/Boarding_0.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 MiB

BIN
www/Boarding_1.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 MiB

BIN
www/Boarding_2.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 MiB

BIN
www/Boarding_3.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 MiB

BIN
www/Togepi.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 KiB

BIN
www/clamp.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

58
www/index.php

@ -0,0 +1,58 @@
<html>
<head>
<title>Electric Scrapeboard</title>
<link rel="stylesheet" href="www/style.css" type="text/css" />
</head>
<body>
<div id="title">
<img id="plank" src="resource/Title_plank.png" />
<img id="board" src="resource/Introduction_skateboard.png" />
<img id="lizard" src="resource/littleSlimeGoop/1_downRight.png" />
</div>
<div id="question">
So you think you can skateboard, but can you <i>scrape</i>board, you slime bag?
</div>
<div id="boarding">
<a href="www/Boarding_1.gif"><img src="www/Boarding_1.gif" width="250" /></a>
<a href="www/Boarding_0.gif"><img src="www/Boarding_0.gif" width="250" /></a>
</div>
<div id="blob">
<div id="detail">
We have the <span class="highlight">technology</span> to put you on a board which is a
wireless electric <span class="highlight">video game</span> controller. Do you have the
<span class="highlight">moves</span> to skate through a gauntlet of goons all the way
to <i>Tony Hawk</i>?
<a id="frank" href="http://twitter.com/diskmem">@diskmem</a>
<a id="blake" href="http://twitter.com/snakesandrews">@snakesandrews</a>
</div>
<div id="detail2">
We have the <span class="highlight">technology</span> to put you on a board which is a
wireless electric <span class="highlight">video game</span> controller. Do you have the
<span class="highlight">moves</span> to skate through a gauntlet of goons all the way
to <i>Tony Hawk</i>?
</div>
<div id="detail3">
We have the <span class="highlight">technology</span> to put you on a board which is a
wireless electric <span class="highlight">video game</span> controller. Do you have the
<span class="highlight">moves</span> to skate through a gauntlet of goons all the way
to <i>Tony Hawk</i>?
</div>
<div id="detail4">
We have the <span class="highlight">technology</span> to put you on a board which is a
wireless electric <span class="highlight">video game</span> controller. Do you have the
<span class="highlight">moves</span> to skate through a gauntlet of goons all the way
to <i>Tony Hawk</i>?
</div>
<div id="detail5">
We have the <span class="highlight">technology</span> to put you on a board which is a
wireless electric <span class="highlight">video game</span> controller. Do you have the
<span class="highlight">moves</span> to skate through a gauntlet of goons all the way
to <i>Tony Hawk</i>?
</div>
</div>
<div id="boarding">
<a href="www/Boarding_2.gif"><img src="www/Boarding_2.gif" width="250" /></a>
<a href="www/Boarding_3.gif"><img src="www/Boarding_3.gif" width="250" /></a>
</div>
</body>
</html>

163
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;
}
Loading…
Cancel
Save