Compare commits

...

7 Commits

Author SHA1 Message Date
Storm Dragon
d30a376c1a Renamed the menu. Added some dialog functions in preparation for moving to dialog. 2019-08-21 23:54:32 -04:00
Storm Dragon
4ea447b9e1 Escape closes soxsynth. 2018-05-12 17:47:37 -04:00
Storm Dragon
4872c92ca0 Added the length to win message. 2018-05-09 20:54:20 -04:00
Storm Dragon
2203a30aa4 sounds-Abound now works with space or enter. 2018-05-09 20:18:35 -04:00
Storm Dragon
9a85a6d12d Working game menu! 2018-05-09 19:29:50 -04:00
Storm Dragon
a9be38ea09 Non-working menu. 2018-05-09 19:12:58 -04:00
Storm Dragon
e812e45134 simone is slightly more friendly, plus, now you can use the arrow keys to play. 2018-05-08 19:28:41 -04:00
74 changed files with 175 additions and 736 deletions

10
bashit/.bashit.scoreboard Normal file
View File

@ -0,0 +1,10 @@
10 Anonymous
0 Anonymous
0 anonymous
0 anonymous
0 anonymous
0 anonymous
0 anonymous
0 anonymous
0 anonymous
0 anonymous

View File

@ -1,189 +0,0 @@
-- Store operating system commands in a variable.
function os.capture(cmd, raw)
local f = assert(io.popen(cmd, 'r'))
local s = assert(f:read('*a'))
f:close()
if raw then
return s
end
s = string.gsub(s, '^%s+', '')
s = string.gsub(s, '%s+$', '')
s = string.gsub(s, '[\n\r]+', ' ')
return s
end
-- Speak with appropriate tool.
local function speak(text)
if os.capture("uname") == "Linux" then
os.execute('spd-say "' .. text .. '"')
else
os.execute('say "' .. text .. '"')
end
end
-- Window related variables.
local gameName = "Bottle Blaster"
local SDL = require "SDL"
local mixer = require "SDL.mixer"
local ret, err = SDL.init { SDL.flags.Video }
if not ret then
error(err)
end
local function trySDL(func, ...)
local t = { func(...) }
if not t[1] then
error(t[#t])
end
return table.unpack(t)
end
local function exit_game(SDL, mixer)
SDL.quit()
mixer.quit()
return false
end
local win, err = SDL.createWindow {
title = gameName,
width = 320,
height = 320
}
if not win then
error(err)
end
trySDL(mixer.openAudio, 44100, SDL.audioFormat.S16, 2, 1024)
-- Load all game sounds here:
-- Format: local variableName = trySDL(mixer.loadWAV, "path/to/file")
-- Supported file types flac, ogg, wav
local bottle =
{
trySDL(mixer.loadWAV, "sounds/glass1.ogg"),
trySDL(mixer.loadWAV, "sounds/glass2.ogg"),
trySDL(mixer.loadWAV, "sounds/glass3.ogg")
}
local gun =
{
trySDL(mixer.loadWAV, "sounds/gun1.ogg"),
trySDL(mixer.loadWAV, "sounds/gun2.ogg"),
trySDL(mixer.loadWAV, "sounds/gun3.ogg"),
trySDL(mixer.loadWAV, "sounds/gun4.ogg"),
trySDL(mixer.loadWAV, "sounds/gun5.ogg")
}
local empty = trySDL(mixer.loadWAV, "sounds/empty.ogg")
local load = {}
load[3] = trySDL(mixer.loadWAV, "sounds/load3.ogg")
load[4] = trySDL(mixer.loadWAV, "sounds/load3.ogg")
load[5] = trySDL(mixer.loadWAV, "sounds/load5.ogg")
local function play_sound(sound, channel, loop)
channel = channel or -1
loop = loop or 0
sound:playChannel(channel, loop)
end
local function play_at_location(sound, xPosition, yPosition)
channel = channel or -1
loop = loop or 0
xPosition = xPosition or 0
yPosition = yPosition or 0
mixer.SetPanning(-1, 255, 127)
sound:playChannel(-1, 0)
end
local function game_intro()
local sound = trySDL(mixer.loadWAV, "sounds/game-intro.ogg")
sound:playChannel(-1, 0)
while mixer.playing(-1) > 0 do
SDL.delay(100)
end
end
-- Game variables
local direction = ""
local holdKey = {}
local keyName = ""
local loaded = true
local playerPosition = math.random(0, 30)
local running = true
local weapon = 1
-- game functions.
local function player_move(position, direction)
if direction == "Left" and position > 0 then
position = position - 1
end
if direction == "Right" and position < 30 then
position = position + 1
end
return position
end
game_intro()
-- Main game loop.
while running do
-- Need a timer to make holding arrows move at a slower speed. for player_move()
playerPosition = player_move(playerPosition, direction)
-- Iterate over all events, this function does not block.
for e in SDL.pollEvent() do
if e.type == SDL.event.KeyUp then --chrys just recognice the keyup and free the loop
keyName = SDL.getKeyName(e.keysym.sym)
holdKey[keyName] = false
direction = ""
-- speak(playerPosition)
end
if e.type == SDL.event.Quit then
running = false
elseif e.type == SDL.event.KeyDown and not holdKey[keyName] then -- chrysif not already down ( see below)
keyName = SDL.getKeyName(e.keysym.sym)
holdKey[keyName] = true --chrys mark the remember the keydown
if keyName == "Q" then
running = exit_game(SDL, mixer)
elseif keyName == "Left Shift" or keyName == "Right Shift" then
if weapon >= 3 and loaded == false then
-- Need to not allow firing until loading is complete.
play_sound(load[weapon])
end
loaded = true
elseif keyName == "Space" then
if loaded == true then
play_sound(gun[weapon])
play_sound(bottle[math.random(1, #bottle)])
else
play_sound(empty)
end
if weapon >= 3 then
loaded = false
end
elseif keyName == "Left" or keyName == "Right" then
direction = keyName
elseif tonumber(keyName) == nil then -- make sure keyName can be converted to a number for remaing if statements to avoid a crash.
keyName = "0"
elseif tonumber(keyName) >= 1 and tonumber(keyName) <= 5 then
weapon = tonumber(keyName)
if weapon >= 3 then
loaded = false
else
loaded = true
end
if weapon == 1 then
speak("pistal")
elseif weapon == 2 then
speak("beretta")
elseif weapon == 3 then
speak("boomstick shotgun")
elseif weapon == 4 then
speak("pump action shotgun")
elseif weapon == 5 then
speak("bo and arrow")
end
end
end
end
end

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

95
game_functions.sh Executable file
View File

@ -0,0 +1,95 @@
#!/bin/bash
# Get the coluns and lines of the "screen"
cols=$(tput cols)
lines=$(tput lines)
# Settings to improve accessibility of dialog.
export DIALOGOPTS='--insecure --no-lines --visit-items'
inputbox() {
# Returns: text entered by the user
# Args 1, Instructions for box.
# args: 2 initial text (optional)
dialog --backtitle "$(gettext "Enter text and press enter.")" \
--clear \
--inputbox "$1" 0 0 "$2" --stdout
}
msgbox() {
# Returns: None
# Shows the provided message on the screen with an ok button.
dialog --clear --msgbox "$*" 10 72
}
infobox() {
# Returns: None
# Shows the provided message on the screen with no buttons.
local timeout=3
dialog --infobox "$*" 0 0
read -n1 -t $timeout continue
# Clear any keypresses from the buffer
clear_buffer
}
yesno() {
# Returns: Yes or No
# Args: Question to user.
# Called in if $(yesno) == "Yes"
# Or variable=$(yesno)
if dialog --clear --backtitle "$(gettext "Press 'Enter' for \"yes\" or 'Escape' for \"no\".")" --yesno "$*" 0 0 ; then
echo "Yes"
else
echo "No"
fi
}
get_keypress() {
# Returnes the pressed key.
# There arre two ways to use this function.
# first way, get_keypress variableName
# Second way variableName="$(get_keypress)"
# This variable name is long to absolutely minimize possibility of collision.
local getKeypressFunctionReturnVariable=$1
local returnedKeypress
# Unset IFS to capture any key that is pressed.
local ifs="$IFS"
unset IFS
read -sn1 returnedKeypress
# Restore IFS
IFS="$ifs"
if [[ $getKeypressFunctionReturnVariable ]]; then
eval $getKeypressFunctionReturnVariable="'$returnedKeypress'"
else
echo "$returnedKeypress"
fi
}
menulist() {
# Args: menu options
# returns: selected option
# set gameMenu to control the message.
declare -a menuList
for i in $@ ; do
menuList+=("$i" "$i")
done
dialog --backtitle "${menuMessage:-Game menu...}" \
--clear \
--no-tags \
--menu "Please make your selection" 0 0 0 "${menuList[@]}" --stdout
}
numpicker() {
# Args: max number, Min numberr optional.
# returns: selected number
# set gameMenu to control the message.
declare -a menuList
local max=$1
local min=${2:-10}
for i in $(seq $min $max) ; do
menuList+=("$i" "$i")
done
dialog --backtitle "${menuMessage:-Numeric menu...}" \
--clear \
--no-tags \
--menu "Please select a number between $min and $max." 0 0 0 "${menuList[@]}" --stdout
}

108
getkey.sh
View File

@ -1,108 +0,0 @@
#!/bin/bash
# Reset terminal to current state when we exit.
trap "stty $(stty -g)" EXIT
# Disable echo and special characters, set input timeout to 0.2 seconds.
stty -echo -icanon time 2 || exit $?
# String containing all keypresses.
KEYS=""
# Set field separator to BELL (should not occur in keypresses)
IFS=$'\a'
# Input loop.
while [ 1 ]; do
# Read more input from keyboard when necessary.
while read -t 0 ; do
read -s -r -d "" -N 1 -t 0.2 CHAR && KEYS="$KEYS$CHAR" || break
done
# If no keys to process, wait 0.05 seconds and retry.
if [ -z "$KEYS" ]; then
sleep 0.02
continue
fi
# Check the first (next) keypress in the buffer.
case "$KEYS" in
$'\x1B\x5B\x41'*) # Up arrow
KEYS="${KEYS##???}"
KEY="Arrow_U"
;;
$'\x1B\x5B\x42'*) # Down Arrow
KEYS="${KEYS##???}"
KEY="Arrow_D"
;;
$'\x1B\x5B\x44'*) # Left Arrow
KEYS="${KEYS##???}"
KEY="Arrow_L"
;;
$'\x1B\x5B\x43'*) # Right Arrow
KEYS="${KEYS##???}"
KEY="Arrow_R"
;;
$'\x1B\x4F\x48'*) # Home
KEYS="${KEYS##???}"
KEY="Home"
;;
$'\x1B\x5B\x31\x7E'*) # Home (Numpad)
KEYS="${KEYS##????}"
KEY="Home"
;;
$'\x1B\x4F\x46'*) # End
KEYS="${KEYS##???}"
KEY="End"
;;
$'\x1B\x5B\x34\x7E'*) # End (Numpad)
KEYS="${KEYS##????}"
KEY="End"
;;
$'\x1B\x5B\x45'*) # 5 (Numpad)
KEYS="${KEYS#???}"
KEY="Numpad_5"
;;
$'\x1B\x5B\x35\x7e'*) # PageUp
KEYS="${KEYS##????}"
KEY="Page_U"
;;
$'\x1B\x5B\x36\x7e'*) # PageDown
KEYS="${KEYS##????}"
KEY="Page_D"
;;
$'\x1B\x5B\x32\x7e'*) # Insert
KEYS="${KEYS##????}"
KEY="Insert"
;;
$'\x1B\x5B\x33\x7e'*) # Delete
KEYS="${KEYS##????}"
KEY="Delete"
;;
$'\n'*|$'\r'*) # Enter/Return
KEYS="${KEYS##?}"
KEY="Enter"
;;
$'\t'*) # Tab
KEYS="${KEYS##?}"
KEY="Tab"
;;
$'\x1B') # Esc (without anything following!)
KEYS="${KEYS##?}"
exit 0
;;
$'\x1B'*) # Unknown escape sequences
echo -n "Unknown escape sequence (${#KEYS} chars): \$'"
echo -n "$KEYS" | od --width=256 -t x1 | sed -e '2,99 d; s|^[0-9A-Fa-f]* ||; s| |\\x|g; s|$|'"'|"
KEYS=""
;;
[$'\x01'-$'\x1F'$'\x7F']*) # Consume control characters
KEYS="${KEYS##?}"
;;
*) # Printable characters.
KEY="${KEYS:0:1}"
KEYS="${KEYS#?}"
;;
esac
echo "$KEY"
done

View File

@ -1,32 +0,0 @@
#!/bin/bash
#If there is more than one command line arg something is wrong
if [ $# -gt 1 ] ; then
echo "usage:
$0 godname"
exit 1
fi
#set godName variable if it was passed from the command line
if [ $# -eq 1 ] ; then
godName="$1"
fi
#read from file if it exists, and name wasn't passed in on command line
if [ -f .godville-trackerrc -a $# -eq 0 ] ; then
source .godville-trackerrc
fi
#if name is not set in file, prompt for it here
if [ -z "$godName" ] ; then
read -p "Please enter the god's name? " godName
fi
godvilleInfo="$(curl -Ss "http://godvillegame.com/gods/api/${godName}.json")"
clear
#remove most of the json stuff
godvilleInfo="$(echo "$godvilleInfo" | sed -e 's/":"/ /g' -e 's/","/\n/g')"
godvilleInfo="$(echo "$godvilleInfo" | sed -e 's/":/ /g' -e 's/,"/\n/g')"
godvilleInfo="$(echo "$godvilleInfo" | sed -e 's/{"//g' -e 's/"}//g')"
echo "$godvilleInfo"
exit 0

View File

@ -1,103 +0,0 @@
#!/bin/bash
#If there is more than one command line arg something is wrong
if [ $# -gt 1 ] ; then
echo "usage:
$0 godname"
exit 1
fi
#set godName variable if it was passed from the command line
if [ $# -eq 1 ] ; then
godName="$1"
fi
#read from file if it exists, and name wasn't passed in on command line
if [ -f .godville-trackerrc -a $# -eq 0 ] ; then
source .godville-trackerrc
fi
#if name is not set in file, prompt for it here
if [ -z "$godName" ] ; then
read -p "Please enter the god's name? " godName
fi
#Counter variable initialization
i=60
#main update loop
while [ "${continue^}" != "Q" ] ; do
#Update info every minute
if [ $i -ge 60 ] ; then
godvilleInfo="$(curl -Ss "http://godvillegame.com/gods/api/${godName}.json")"
#godvilleInfo="$(cat tmp.txt)"
clear
#remove most of the json stuff, and other formatting goodness
godvilleInfo="$(echo "$godvilleInfo" | sed -e 's/":"/ /g' -e 's/","/\n/g')"
godvilleInfo="$(echo "$godvilleInfo" | sed -e 's/":/ /g' -e 's/,"/\n/g')"
godvilleInfo="$(echo "$godvilleInfo" | sed -e 's/{"//g' -e 's/"}//g' -e 's/}}//g' -e 's/\\u201[c|d]/"/g')"
#load info into variables
alignment="$(echo "$godvilleInfo" | grep "^alignment" | cut -d ' ' -f2-)"
bricks_cnt="$(echo "$godvilleInfo" | grep "^bricks_cnt" | cut -d ' ' -f2-)"
bricks_cnt=$(echo "scale=1;$bricks_cnt * 0.1" | bc)
clan="$(echo "$godvilleInfo" | grep "^clan " | cut -d ' ' -f2-)"
clan_position="$(echo "$godvilleInfo" | grep "^clan_position" | cut -d ' ' -f2-)"
gender="$(echo "$godvilleInfo" | grep "^gender" | cut -d ' ' -f2-)"
gold_approx="$(echo "$godvilleInfo" | grep "^gold_approx" | cut -d ' ' -f2-)"
inventory="$(echo "$godvilleInfo" | grep "^inventory " | cut -d ' ' -f2-)"
inventory_max_num="$(echo "$godvilleInfo" | grep "^inventory_max_num" | cut -d ' ' -f2-)"
level="$(echo "$godvilleInfo" | grep "^level" | cut -d ' ' -f2-)"
name="$(echo "$godvilleInfo" | grep "^name" | cut -d ' ' -f2-)"
max_health="$(echo "$godvilleInfo" | grep "^max_health" | cut -d ' ' -f2-)"
motto="$(echo "$godvilleInfo" | grep "^motto" | cut -d ' ' -f2-)"
pet_class="$(echo "$godvilleInfo" | grep "^pet_class" | cut -d ' ' -f2-)"
pet_level="$(echo "$godvilleInfo" | grep "^pet_level" | cut -d ' ' -f2-)"
pet_name="$(echo "$godvilleInfo" | grep "^pet pet_name" | cut -d ' ' -f3-)"
quest="$(echo "$godvilleInfo" | grep "^quest" | cut -d ' ' -f2-)"
temple_completed_at="$(echo "$godvilleInfo" | grep "^temple_completed_at" | cut -d ' ' -f2-)"
if [ "$temple_completed_at" != "null" ] ; then
temple_completed_at="$(date --date="$temple_completed_at" +'%I:%M%p %A, %B %d, %Y')"
fi
#display Information
echo "God
Name: $godName
Hero
Name: $name ($gender)
Motto: $motto
Personality: $alignment"
#Not everyone is in a clan:
if [ -n "$clan" ] ; then
echo "Guild: $clan ($clan_position)"
fi
echo "Level: $level
Inventory: ### / $inventory_max_num
Health: ### / $max_health
Quest: $quest
Gold: $gold_approx
Bricks for Temple: $bricks_cnt%"
#Not everyone has completed their temple
if [ "$temple_completed_at" != "null" ] ; then
echo "Temple Completed: $temple_completed_at"
fi
#Not everyone has a pet
if [ -n "$pet_name" ] ; then
echo
echo "Pet
Name: $pet_name
Class $pet_class"
#Not all pets show a level
if [[ "$pet_level" =~ ^[0-9]+$ ]] ; then
echo "Level: $pet_level"
fi
fi
#reset counter variable
i=0
fi
#Wait for user input and sleep for 1 second
read -t1 -n1 continue
#Incriment counter
let i++
done
echo
exit 0

30
menu.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
export DIALOGOPTS='--no-lines --visit-items'
cols=$(tput cols)
lines=$(tput lines)
path="$(realpath "$0")"
path="${path%/*}"
declare -A gameList
for i in $path/*/ ; do
i="${i::-1}"
gameList[${i##*/}]="${i}"
done
gameList[exit]="Exit"
while : ; do
game="$(dialog --backtitle "Storm Games" \
--menu "Select A Game" $((lines - 5)) $cols $((lines / 2)) $(
for i in ${!gameList[@]} ; do
echo "$i"
echo '|'
done) --stdout)"
if [[ "$game" != "exit" && -n "$game" ]]; then
cd "${gameList[$game]}"
./$game""
echo
read -n1 -p "Press any key to continue" continue
else
break
fi
done
exit 0

View File

@ -1,38 +0,0 @@
#!/bin/python
# -*- coding: utf-8 -*-
from storm_games import *
# Initial variable settings
gameName = "Mine Racer"
mode = "menu"
sounds = initialize_gui(gameName)
def game():
pygame.mixer.music.load("sounds/music_car.ogg")
gameOver = False
jump = False
points = 0
position = 0
while not gameOver:
if pygame.mixer.music.get_busy() == 0 and jump == False: pygame.mixer.music.play(-1)
event = pygame.event.wait()
time.sleep(10)
exit_game()
# Game starts at main menu
mode = game_menu("start game", "credits", "exit_game")
while True:
# wait for an event
event = pygame.event.wait()
# if the event is about a keyboard button that have been pressed...
if event.type == pygame.KEYDOWN:
# Escape is the back/exit key, close the game if not playing, or return to menu if playing.
if event.key == pygame.K_ESCAPE:
if mode != "menu": mode = "menu"
if mode == "menu": exit_game()
# Call the game menu, if needed.
if mode == "menu": mode = game_menu("start game", "credits", "exit_game")
if mode == "start game": game()
time.sleep(.001)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,81 +0,0 @@
#!/bin/python
# -*- coding: utf-8 -*-
"""Standard initializations and functions shared by all games."""
import os
from os import listdir
from os.path import isfile, join
from inspect import isfunction
import pygame
import speechd
import time
spd = speechd.Client()
def speak(text, interupt = True):
if interupt == True: spd.cancel()
spd.say(text)
def exit_game():
spd.close()
pygame.quit()
exit()
def initialize_gui(gameTitle):
# start pygame
pygame.init()
# start the display (required by the event loop)
pygame.display.set_mode((320, 200))
pygame.display.set_caption(gameTitle)
# Load sounds from the sound directory and creates a list like that {'bottle': 'bottle.ogg'}
soundFiles = [f for f in listdir("sounds/") if isfile(join("sounds/", f)) and (f.split('.')[1].lower() in ["ogg","wav"])]
#lets make a dict with pygame.mixer.Sound() objects {'bottle':<soundobject>}
soundData = {}
for f in soundFiles:
soundData[f.split('.')[0]] = pygame.mixer.Sound("sounds/" + f)
soundData['game-intro'].play()
time.sleep(soundData['game-intro'].get_length())
return soundData
def game_menu(*options):
loop = True
pygame.mixer.music.load("sounds/music_menu.ogg")
pygame.mixer.music.set_volume(0.75)
pygame.mixer.music.play(-1)
i = 0
speak(options[i])
while loop == True:
event = pygame.event.wait()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE: exit_game()
if event.key == pygame.K_DOWN and i < len(options) - 1: i = i + 1
if event.key == pygame.K_UP and i > 0: i = i - 1
if event.key == pygame.K_RETURN:
try:
eval(options[i] + "()")
continue
except:
time.sleep(0.25)
return options[i]
continue
speak(options[i])
event = pygame.event.clear()
time.sleep(0.001)
def credits():
info = (
"Mine Racer: brought to you by Storm Dragon",\
"Billy Wolfe, designer and coder.",\
"http://stormdragon.tk",\
"Press escape or enter to return to the game menu.")
i = 0
speak(info[i])
while True:
event = pygame.event.wait()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE or event.key == pygame.K_RETURN: return
if event.key == pygame.K_DOWN and i < len(info) - 1: i = i + 1
if event.key == pygame.K_UP and i > 0: i = i - 1
speak(info[i])
event = pygame.event.clear()
time.sleep(0.001)

View File

@ -1,23 +0,0 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Shoot the bottles as fast as possible.
from storm_games import *
sounds = initialize_gui("Bottle Blaster")
# loop forever (until a break occurs)
while True:
# wait for an event
event = pygame.event.wait()
# if the event is about a keyboard button that have been pressed...
if event.type == pygame.KEYDOWN:
sounds['bottle'].play(-1)
speak("This is a test.")
if event.type == pygame.KEYUP:
sounds['bottle'].stop()
# and if the button is the "q" letter or the "escape" key...
if event.key == pygame.K_ESCAPE:
# ... then exit from the while loop
break
time.sleep(.001)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,29 +0,0 @@
#!/bin/python
# -*- coding: utf-8 -*-
"""Standard initializations and functions shared by all games."""
from espeak import espeak
import os
from os import listdir
from os.path import isfile, join
import pygame
import time
def speak(text, interupt = True):
if interupt == True: espeak.cancel()
espeak.set_voice("en-us")
espeak.synth(text)
def initialize_gui(gameTitle):
# start pygame
pygame.init()
# start the display (required by the event loop)
pygame.display.set_mode((320, 200))
pygame.display.set_caption(gameTitle)
# Load sounds from the sound directory and creates a list like that {'bottle': 'bottle.ogg'}
soundFiles = [f for f in listdir("sounds/") if isfile(join("sounds/", f)) and (f.split('.')[1].lower() in ["ogg","wav"])]
#lets make a dict with pygame.mixer.Sound() objects {'bottle':<soundobject>}
soundData = {}
for f in soundFiles:
soundData[f.split('.')[0]] = pygame.mixer.Sound("sounds/" + f)
return soundData

33
sex/sex
View File

@ -1,33 +0,0 @@
#!/bin/bash
#simplest way to convert the sex program to bash
#The C version is available from: http://spatula.net/software/sex/
#This version is released under the terms of the WTFPL http://www.wtfpl.net/
#set up random parts of the sentence
faster="$(shuf -n 1 -e "\"Let the games begin!\"" "\"Sweet Jesus!\"" "\"Not that!\"" "\"At last!\"" "\"Land o' Goshen!\"" "\"Is that all?\"" "\"Cheese it, the cops!\"" "\"I never dreamed it could be\"" "\"If I do, you won't respect me!\"" "\"Now!\"" "\"Open sesame!\"" "\"EMR!\"" "\"Again!\"" "\"Faster!\"" "\"Harder!\"" "\"Help!\"" "\"Fuck me harder!\"" "\"Is it in yet?\"" "\"You aren't my father!\"" "\"Doctor, that's not *my* shou\"" "\"No, no, do the goldfish!\"" "\"Holy Batmobile, Batman!\"" "\"He's dead, he's dead!\"" "\"Take me, Robert!\"" "\"I'm a Republican!\"" "\"Put four fingers in!\"" "\"What a lover!\"" "\"Talk dirty, you pig!\"" "\"The ceiling needs painting,\"" "\"Suck harder!\"" "\"The animals will hear!\"" "\"Not in public!\"")"
said="$( shuf -n 1 -e "bellowed" "yelped" "croaked" "growled" "panted" "moaned" "grunted" "laughed" "warbled" "sighed" "ejaculated" "choked" "stammered" "wheezed" "squealed" "whimpered" "salivated" "tongued" "cried" "screamed" "yelled" "said")"
fadj="$(shuf -n 1 -e "saucy" "wanton" "unfortunate" "lust-crazed" "nine-year-old" "bull-dyke" "bisexual" "gorgeous" "sweet" "nymphomaniacal" "large-hipped" "freckled" "forty-five year old" "white-haired" "large-boned" "saintly" "blind" "bearded" "blue-eyed" "large tongued" "friendly" "piano playing" "ear licking" "doe eyed" "sock sniffing" "lesbian" "hairy")"
female="$(shuf -n 1 -e "baggage" "hussy" "woman" "Duchess" "female impersonator" "nymphomaniac" "virgin" "leather freak" "home-coming queen" "defrocked nun" "bisexual budgie" "cheerleader" "office secretary" "sexual deviate" "DARPA contract monitor" "little matchgirl" "ceremonial penguin" "femme fatale" "bosses' daughter" "construction worker" "sausage abuser" "secretary" "Congressman's page" "grandmother" "penguin" "German shepherd" "stewardess" "waitress" "prostitute" "computer science group" "housewife")"
madjec="$(shuf -n 1 -e "thrashing" "slurping" "insatiable" "rabid" "satanic" "corpulent" "nose-grooming" "tripe-fondling" "dribbling" "spread-eagled" "orally fixated" "vile" "awesomely endowed" "handsome" "mush-brained" "tremendously hung" "three-legged" "pile-driving" "cross-dressing" "gerbil buggering" "bung-hole stuffing" "sphincter licking" "hair-pie chewing" "muff-diving" "clam shucking" "egg-sucking" "bicycle seat sniffing")"
male="$(shuf -n 1 -e "rakehell" "hunchback" "lecherous lickspittle" "archduke" "midget" "hired hand" "great Dane" "stallion" "donkey" "electric eel" "paraplegic pothead" "dirty old man" "faggot butler" "friar" "black-power advocate" "follicle fetishist" "handsome priest" "chicken flicker" "homosexual flamingo" "ex-celibate" "drug sucker" "ex-woman" "construction worker" "hair dresser" "dentist" "judge" "social worker")"
diddled="$(shuf -n 1 -e "diddled" "devoured" "fondled" "mouthed" "tongued" "lashed" "tweaked" "violated" "defiled" "irrigated" "penetrated" "ravished" "hammered" "bit" "tongue slashed" "sucked" "fucked" "rubbed" "grudge fucked" "masturbated with" "slurped")"
titadj="$(shuf -n 1 -e "alabaster" "pink-tipped" "creamy" "rosebud" "moist" "throbbing" "juicy" "heaving" "straining" "mammoth" "succulent" "quivering" "rosey" "globular" "varicose" "jiggling" "bloody" "tilted" "dribbling" "oozing" "firm" "pendulous" "muscular" "bovine")"
knockers="$(shuf -n 1 -e "globes" "melons" "mounds" "buds" "paps" "chubbies" "protuberances" "treasures" "buns" "bung" "vestibule" "armpits" "tits" "knockers" "elbows" "eyes" "hooters" "jugs" "lungs" "headlights" "disk drives" "bumpers" "knees" "fried eggs" "buttocks" "charlies" "ear lobes" "bazooms" "mammaries")"
thrust="$(shuf -n 1 -e "plunged" "thrust" "squeezed" "pounded" "drove" "eased" "slid" "hammered" "squished" "crammed" "slammed" "reamed" "rammed" "dipped" "inserted" "plugged" "augured" "pushed" "ripped" "forced" "wrenched")"
dongadj="$(shuf -n 1 -e "bursting" "jutting" "glistening" "Brobdingnagian" "prodigious" "purple" "searing" "swollen" "rigid" "rampaging" "warty" "steaming" "gorged" "trunklike" "foaming" "spouting" "swinish" "prosthetic" "blue veined" "engorged" "horse like" "throbbing" "humongous" "hole splitting" "serpentine" "curved" "steel encased" "glass encrusted" "knobby" "surgically altered" "metal tipped" "open sored" "rapidly dwindling" "swelling" "miniscule" "boney")"
dong="$(shuf -n 1 -e "intruder" "prong" "stump" "member" "meat loaf" "majesty" "bowsprit" "earthmover" "jackhammer" "ramrod" "cod" "jabber" "gusher" "poker" "engine" "brownie" "joy stick" "plunger" "piston" "tool" "manhood" "lollipop" "kidney prodder" "candlestick" "John Thomas" "arm" "testicles" "balls" "finger" "foot" "tongue" "dick" "one-eyed wonder worm" "canyon yodeler" "middle leg" "neck wrapper" "stick shift" "dong" "Linda Lovelace choker")"
twatadj="$(shuf -n 1 -e "pulsing" "hungry" "hymeneal" "palpitating" "gaping" "slavering" "welcoming" "glutted" "gobbling" "cobwebby" "ravenous" "slurping" "glistening" "dripping" "scabiferous" "porous" "soft-spoken" "pink" "dusty" "tight" "odiferous" "moist" "loose" "scarred" "weapon-less" "banana stuffed" "tire tracked" "mouse nibbled" "tightly tensed" "oft traveled" "grateful" "festering")"
twat="$(shuf -n 1 -e "swamp." "honeypot." "jam jar." "butterbox." "furburger." "cherry pie." "cush." "slot." "slit." "cockpit." "damp." "furrow." "sanctum sanctorum." "bearded clam." "continental divide." "paradise valley." "red river valley." "slot machine." "quim." "palace." "ass." "rose bud." "throat." "eye socket." "tenderness." "inner ear." "orifice." "appendix scar." "wound." "navel." "mouth." "nose." "cunt.")"
#set default wordwrap to 80
if [[ "$1" == "-w" && "$2" =~ ^[0-9]+$ && $2 -gt 0 && $2 -le 500 ]] ; then
lineLength=$2
fi
#generate the sentence with wordwrap
if [ -n "$lineLength" ] ; then
echo "$faster $said the $fadj $female as the $madjec $male $diddled her $titadj $knockers and $thrust his $dongadj $dong into her $twatadj $twat" | fold -sw $lineLength
else
echo "$faster $said the $fadj $female as the $madjec $male $diddled her $titadj $knockers and $thrust his $dongadj $dong into her $twatadj $twat"
fi
exit 0

View File

@ -8,6 +8,33 @@
# There are 2 sets of keybindings. uijk or erdf. # There are 2 sets of keybindings. uijk or erdf.
# The lowest note is e or u, with r or i being the next highest. # The lowest note is e or u, with r or i being the next highest.
# Finally d or j follow by f and k for the ascending pitches. # Finally d or j follow by f and k for the ascending pitches.
# Note the arrow keys may also be used.
# Down is lowest with left, then right, then up in order of pitch.
get_key() {
# Arrow keys translate to upper case letters.
# Up arrow is A
# Down arrow is B
# Left arrow is D
local __key
local __lastKey
while [[ -z "$__key" && -z "$__lastKey" ]]; do
read -t 001 -rsn1 __key
while [[ "$__key" =~ [[:cntrl:][:punct:]] ]]; do
# Key may be an arrow or something else, so remove punct and cntrl characters and try again.
if [[ -n "$__key" ]]; then
__lastKey="$__key"
else
__key="$__lastKey"
break
fi
read -t 001 -rsn1 __key
done
done
# Return __key if it contains a letter.
# If it doesn't, then a punctuation key was pressed, so return __lastKey instead.
[[ -n "$__key" ]] && echo "$__key" || echo "$__lastKey"
}
# Simon notes # Simon notes
notes=("sq E4" "sq C#4" "sq A3" "sq E3") notes=("sq E4" "sq C#4" "sq A3" "sq E3")
@ -24,11 +51,12 @@ done
# Clear the player variable # Clear the player variable
unset player unset player
i=0 i=0
while read -sn1 key ; do while : ; do
key="$(echo "$key" | tr 'fk' '0')" key="$(get_key)"
key="$(echo "$key" | tr 'dj' '1')" key="$(echo "$key" | tr 'Afk' '0')"
key="$(echo "$key" | tr 'ir' '2')" key="$(echo "$key" | tr 'Cdj' '1')"
key="$(echo "$key" | tr 'eu' '3')" key="$(echo "$key" | tr 'Dir' '2')"
key="$(echo "$key" | tr 'Beu' '3')"
player=(${player[@]} $key) player=(${player[@]} $key)
# make sure the pressed key exists in the array. # make sure the pressed key exists in the array.
if [[ "$key" =~ [0-3] ]]; then if [[ "$key" =~ [0-3] ]]; then

View File

@ -1,19 +0,0 @@
#!/bin/bash
if [ $# -ne 1 ] ; then
echo "Usage: soundboard name, where name is the name of a soundboard you want to load."
exit 1
fi
if ! [ -d sounds/$1 ] ; then
echo "soundboard $1 not found."
exit 1
fi
while [ 1 -gt 0 ] ; do
read -sn1 key
if [ -f sounds/$1/$key.ogg ] ; then
play -qV0 sounds/$1/$key.ogg&
fi
done
exit 0

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -35,15 +35,15 @@ sequence="${sequence}\"|sox -np synth 0.0$(($RANDOM % 5 + 4)) sq ${notes[$(($RAN
done done
eval play -q ${sequence} norm -5 eval play -q ${sequence} norm -5
sleep .5 sleep .5
unset guess guess="win"
i=0 i=0
while [ -z "${guess}" ]; do while [[ "${guess}" == "win" ]]; do
play -nqV0 synth .2 sq E4 pad .3 norm -5 & play -nqV0 synth .2 sq E4 pad .3 norm -5 &
read -sn1 -t .6 guess read -sn1 -t .6 guess || guess="win"
((i++)) ((i++))
done done
if [ $i -eq $length ]; then if [ $i -eq $length ]; then
echo "you win!" echo "you win! The answer was $length!"
else else
echo "you lose" echo "you lose"
echo "You guessed $i. the actual number was $length." echo "You guessed $i. the actual number was $length."

Binary file not shown.

View File

@ -255,6 +255,9 @@ noteLength="0.75"
;; ;;
"=") "=")
noteLength="1.00" noteLength="1.00"
;;
$'\e')
exit 0
esac esac
if [ "$instrument" == "12" ] ; then if [ "$instrument" == "12" ] ; then
play -qn -V0 synth pl ${note}$(($octave + 1)) pl ${note}${octave} delay 0 0.02 remix - $effect fade 0 $noteLength vol $volume &> /dev/null & play -qn -V0 synth pl ${note}$(($octave + 1)) pl ${note}${octave} delay 0 0.02 remix - $effect fade 0 $noteLength vol $volume &> /dev/null &

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,72 +0,0 @@
#!/bin/bash
check_dependancies()
{
if [ $# -eq 0 ] ; then
if [[ $(bash --version | head -n 1 | cut -f 1 -d "." | tr -d "[:alpha:]") < "4" ]] ; then
echo "This game requires bash version 4 or higher. Earlier versions may not be able to successfully run this code."
fi
if ! hash sox &> /dev/null ; then
echo "The program sox is required but does not appear to be installed on your system. Please install sox and try
again."
exit 1
fi
fi
for i in $@ ; do
if ! hash $i &> /dev/null ; then
echo "The program $i is required but does not appear to be installed on your system. Please install $i and try
again."
exit 1
fi
done
}
initialize_players()
{
i=1
while [ $i -le $1 ] ; do
player[$i]=0
let i++
done
}
play_sound()
{
play -qV0 sounds/$@
}
check_dependancies
check_dependancies rolldice
#get terminal width
columns=$(tput cols)
play_sound intro.ogg
#find out how many players there are
if [ $# -gt 1 ] ; then
echo "Usage: $0 or $0 number of players."
exit 1
fi
if [ $# -eq 1 ] ; then
if ! [[ "$1" =~ ^[0-9]+$ ]] ; then
echo "The number of players must be a number, 2 or greater."
exit 1
fi
if [ $1 -lt 2 ] ; then
echo "The number of players must be a number, 2 or greater."
exit 1
fi
totalPlayers=$1
else
totalPlayers=2
cpu=true
fi
initialize_players $totalPlayers
#determine who goes first.
playerIndex=$(rolldice 1d${#player[@]})
while [ $playerIndex -gt 0 ] ; do
score_keeper $playerIndex
let playerIndex++
if [ $playerIndex -gt ${#player[@]} ] ; then
playerIndex=1
fi
done
exit 0