Code Samples

To view art: Art Samples

Code Samples

Flappy Bird Clones

While learning and playing around with Game Salad and Unity, I made two iterations of a flappy bird clone.  The Game Salad version used simple geometry and visual programming, whereas the Unity was created with C# and a Sprite Sheet.

Simple Number Guessing Game Code in Java

import java.util.Random;
import java.util.Scanner;

public class trial
{

public static void main(String[] args)
{

// TODO Auto-generated method stub

Random rand = new Random();
Scanner input = new Scanner(System.in);
int target = rand.nextInt(100)+1;
int guess;

while(true)
{

System.out.println(“Please enter a number >> “);
guess = input.nextInt();
System.out.println(“You have entered ” + guess);
if (guess == target)
{

System.out.println(“You got the right number!!”);
break;

}
else if (guess < target)

System.out.println(“Try another higher number”);

else

System.out.println(“Try a smaller number”);

for (int i = 0; i < 10; i++);

System.out.println(rand.nextInt(100)+1);

}

}

Simple Array Demo in Java

import java.util.ArrayList;
import java.util.Scanner;

public class ArrayListDemo
{

public static void main(String[] args)
{

ArrayList< String> toDoList = new ArrayList< String>(20);
System.out.println(“Enter list entries, when prompted.”);
boolean done = false;
String next = null;
String answer;
Scanner keyboard = new Scanner(System.in);

while (! done)
{

System.out.println(“Input an entry:”);
next = keyboard.nextLine( );
toDoList.add(next);
System.out.print(“More items for the list? “);
answer = keyboard.nextLine( );
if (!(answer.equalsIgnoreCase(“yes”)))
done = true;

}

System.out.println(“The list contains:”);
for (String entry : toDoList)
System.out.println(entry);

ArrayList<Integer> toDoList2 = new ArrayList(20);
System.out.println(
“Enter list entries, when prompted.”);
done = false;
int nextInt = 0;

while (! done)
{

System.out.println(“Input an entry:”);
next = keyboard.nextLine( );
toDoList2.add(Integer.parseInt(next));
System.out.print(“More items for the list? “);
answer = keyboard.nextLine( );
if (!(answer.equalsIgnoreCase(“yes”)))
done = true;

}

System.out.println(“The list contains:”);
for (int entry : toDoList2)
System.out.println(entry);

}

}

Simple C# “Mindreading” Program Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MindReader
{

class Program
{

static void Main(string[] args)
{

Console.WriteLine(“Do you think I can read your thoughts?”);
string userValue = Console.ReadLine();
string message = (userValue == “Yes” || userValue == “yes” || userValue == “sure”) ? “Get ready to be impressed! Press enter when ready to begin.” : “Press enter when you’re ready to have your mind blown.”;
Console.WriteLine(“{0}”, message);
Console.ReadLine();

Console.WriteLine(“Think of any whole number. Keep this number in your head.”);
Console.WriteLine(“Press enter when you’re ready to move on.”);
Console.ReadLine();

Console.WriteLine(“Now, I know I’m a computer, but you’re going to have to do the math for this trick, so you’ll know I’m not cheating.”);
Console.WriteLine(“Multiply your number by two. When you have the answer, press enter.”);
Console.ReadLine();

Console.WriteLine(“Now, add 10 to your total.”);
Console.WriteLine(“Press enter when ready.”);
Console.ReadLine();

Console.WriteLine(“Now, divid your total by 2”);
Console.WriteLine(“Don’t forget your total. Press enter when you’re ready.”);
Console.ReadLine();

Console.WriteLine(“We’re nearly done. The last step is to subtract your original number from the total.”);
Console.WriteLine(“Are you ready to see if I can read your mind? Press enter.”);
Console.ReadLine();

Console.WriteLine(“Your final total is 5!”);

Console.WriteLine(“Are you amazed?”);
userValue = Console.ReadLine();

if (userValue == “Yes” || userValue == “yes” || userValue == “sorta”)

Console.WriteLine(“I knew you would be. Prese enter to see it.”);

else if (userValue == “No” || userValue == “no”)

Console.WriteLine(“You should be.”);

else

Console.WriteLine(“Press enter to continue.”);

Console.WriteLine(“Want to know a secret?”);
userValue = Console.ReadLine();

if (userValue == “Yes” || userValue == “yes” || userValue == “I guess”)

Console.WriteLine(“The answer will always be 5”);

else

Console.WriteLine(“Then I guess you’ll never know how I was psychic. Press enter to exit.”);

Console.ReadLine();

}

}

}

Simple C Code

#include <stdio.h>

char *strcat406(char *str, char *str2)
{

char *dest = str;
char *source = str2;
while(*dest != ‘\0’)
dest += 1;

while(*source != ‘\0’)
{

*dest = *source;
source += 1;
dest += 1;

}

*dest = ‘\0’;
return str;

}

char  *strchr406(char str[], char ch)
{

char *s = str;
while(*s != ‘\0’)
{

if(*s == ch)
return s;
s++;

}
return 0;

}
char *strncpy406(char *str, char *str2, int len)
{

char *dest = str;
char *source = str2;

int i;
for(i = 0; i < len; i++)
{

*dest = *source;
source += 1;
dest += 1;

}
*dest = ‘\0’;
return str;

}

int atoi406(char *str)
{

char *source = str;
int i;
int temp = 0;
for(i = 0; *source != ‘\0’; i++)
{

if((int)*source < 48 || (int)*source > 57)
return 0;
temp *= 10;
temp += (int)*source – 48;
source++;

}
return temp;

}

Global Game Jam 2017 – Bullfrog Bound

The theme this year was waves.  This could be interpreted in a number of ways.  My team chose to use waves both literally and structurally.  Not only does the frog have to avoid the waves in the game, but those waves are generated by use of a sine wave.  The game was constructed with the use of Blueprint in Unreal Engine and the art was created in Photoshop CC 2017.  This was my first game jam and was a wonderful learning experience.  I contributed mostly art, but also game design and watched and learned as Blueprint was used by our main programmer.