In Bash, arguments starts with index 1, while $0 is reserved to the command itself. This applies to functions and commands as well.
This is how you achieve something similar to what you requested:
while [ "$1" != "" ] ; do
case "$1" in
-x)
do_thing_1
;;
-y)
do_thing_2
;;
-z)
do_thing_3
;;
*)
error $1
exit -1
;;
esac
shift
done
You need to declare the functions do_thing_xxx and error.
I said "something similar" because this script will understand "myscript -x -y -z" but detects "myscripts -xyz" as wrong.
To achieve a more complex behavior, like yours, you need to use GETOPT, as explained here: http://wiki.bash-hackers.org/howto/getopts_tutorial
Hope that helps.